:root {
  --bg: #eef0f3;
  --stripe: #e6e9ed;
  --tile: #ffffff;
  --tile-edge: #c9ced4;
  --glow: #34bded;
  --glow-soft: rgb(52 189 237 / 0.35);
  --ink: #5d646d;
  --ink-strong: #3b4048;
  --muted: #8a919b;
  --dock: #dfe3e8;
  --dock-edge: #c3c9d0;
  --font: 'Nunito', ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
  --dock-h: 150px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  /* faint pinstripes, like an old console menu */
  background-image: repeating-linear-gradient(0deg, var(--stripe) 0 2px, transparent 2px 6px);
  color: var(--ink);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button {
  font: inherit;
  color: inherit;
}

.ii {
  color: var(--glow);
}

/* ---------- boot ---------- */

.boot {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  background: #fff;
  cursor: pointer;
  transition: opacity 0.6s ease;
  outline: none;
}
.booted .boot {
  opacity: 0;
  pointer-events: none;
}
.logo {
  font-weight: 800;
  font-size: clamp(64px, 14vw, 128px);
  letter-spacing: -0.02em;
  color: #9aa1aa;
  animation: logo-in 1s ease both;
}
.press {
  margin: 0;
  font-weight: 700;
  font-size: clamp(16px, 2.4vw, 22px);
  color: var(--muted);
  animation: pulse 2s ease-in-out infinite;
}
@media (pointer: coarse) {
  .press {
    font-size: 0;
  }
  .press::after {
    content: 'Tap anywhere to enter';
    font-size: 18px;
  }
}
@keyframes logo-in {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
}
@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

/* ---------- channels ---------- */

.menu {
  position: fixed;
  inset: 0 0 var(--dock-h) 0;
  display: grid;
  place-items: center;
  padding: 3vh 4vw 2vh;
  animation: menu-in 0.7s 0.15s ease both;
}
@keyframes menu-in {
  from {
    opacity: 0;
    transform: scale(1.04);
  }
}
.channels {
  width: min(1180px, 100%);
  max-height: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(10px, 1.8vw, 22px);
}
.channel {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 18px;
  background: var(--tile);
  border: 3px solid var(--tile-edge);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition:
    transform 0.18s cubic-bezier(0.3, 1.5, 0.5, 1),
    border-color 0.15s,
    box-shadow 0.15s;
  outline: none;
}
.channel:not(.empty) {
  cursor: pointer;
}
.channel:not(.empty):hover,
.channel:not(.empty):focus-visible {
  transform: scale(1.06);
  border-color: var(--glow);
  box-shadow:
    0 0 0 4px var(--glow-soft),
    0 8px 24px rgb(52 120 160 / 0.18);
  z-index: 2;
}
.channel.picked {
  transform: scale(0.97);
}
.channel.empty {
  background: repeating-linear-gradient(0deg, #f3f5f7 0 3px, #e9ecef 3px 6px);
  border-color: #d6dade;
}

/* tile art */
.art {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 10%;
}
.art-title {
  position: relative;
  font-weight: 800;
  font-size: clamp(13px, 1.7vw, 22px);
  line-height: 1.1;
}
.serif {
  font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  font-style: italic;
  font-weight: 600;
  font-size: clamp(16px, 2.1vw, 28px);
}

.art-snippets {
  background: #f7f1e4;
  color: #2a241c;
}
.art-snippets .paper {
  position: absolute;
  inset: 14% 12% auto 12%;
  display: flex;
  flex-direction: column;
  gap: clamp(7px, 1.1vw, 14px);
}
.art-snippets .line {
  display: block;
  height: clamp(4px, 0.6vw, 8px);
  border-radius: 4px;
  background: #c9b99a;
  width: 0;
  animation: write 6s ease-in-out infinite;
}
.art-snippets .l2 {
  --w: 70%;
  animation-delay: 1.2s;
}
.art-snippets .l3 {
  animation-delay: 2.4s;
  background: #c2410c;
}
@keyframes write {
  0% {
    width: 0;
  }
  20%,
  80% {
    width: var(--w, 92%);
  }
  95%,
  100% {
    width: 0;
  }
}
.art-real {
  background: #7c3aed;
  color: #fff;
  gap: 4%;
}
.art-real .bubble {
  position: absolute;
  font-size: clamp(9px, 1.05vw, 13px);
  font-weight: 700;
  padding: 3% 6%;
  border-radius: 999px;
  background: #fff;
  color: #3b1d80;
  white-space: nowrap;
  opacity: 0;
  animation: bubble 6s ease infinite;
}
.art-real .b1 {
  top: 8%;
  left: 7%;
}
.art-real .b2 {
  top: 26%;
  right: 7%;
  background: #fde047;
  color: #4a3b00;
  animation-delay: 0.9s;
}
.art-real .b3 {
  top: 44%;
  left: 12%;
  animation-delay: 1.8s;
}
@keyframes bubble {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.9);
  }
  8%,
  80% {
    opacity: 1;
    transform: none;
  }
  92%,
  100% {
    opacity: 0;
  }
}

/* ---------- dock ---------- */

.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--dock-h);
  padding-bottom: env(safe-area-inset-bottom);
  animation: dock-in 0.6s 0.25s ease both;
}
@keyframes dock-in {
  from {
    transform: translateY(100%);
  }
}
.dock-shape {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.dock-shape path {
  fill: var(--dock);
}
.dock-shape .dock-line {
  fill: none;
  stroke: var(--glow);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}
.clock {
  position: absolute;
  left: 50%;
  top: 20%;
  transform: translateX(-50%);
  text-align: center;
  color: var(--ink);
}
.time {
  font-weight: 700;
  font-size: 52px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.colon {
  animation: blink 2s steps(1) infinite;
}
@keyframes blink {
  50% {
    opacity: 0.25;
  }
}
.date {
  margin-top: 6px;
  font-weight: 700;
  font-size: 18px;
  color: var(--muted);
}
.round-btn {
  position: absolute;
  top: 40px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: 3px solid var(--dock-edge);
  background: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: inset 0 -4px 0 #eef0f3;
  transition:
    transform 0.18s cubic-bezier(0.3, 1.5, 0.5, 1),
    border-color 0.15s,
    box-shadow 0.15s;
}
.round-btn:hover,
.round-btn:focus-visible {
  border-color: var(--glow);
  box-shadow:
    0 0 0 4px var(--glow-soft),
    inset 0 -4px 0 #eef0f3;
  transform: scale(1.06);
  outline: none;
}
.round-btn:active {
  transform: scale(0.95);
}
.round-btn.left {
  left: max(4vw, 20px);
}
.round-btn.right {
  right: max(4vw, 20px);
}
.round-label {
  font-weight: 800;
  font-size: 22px;
  color: #9aa1aa;
}
.round-btn svg {
  width: 44px;
  fill: none;
  stroke: #9aa1aa;
  stroke-width: 3;
  stroke-linejoin: round;
}

/* ---------- panels ---------- */

.panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(230 234 238 / 0.7);
  backdrop-filter: blur(6px);
  animation: fade 0.2s ease;
}
.panel-backdrop[hidden] {
  display: none;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.panel {
  width: min(440px, 100%);
  background: #fff;
  border: 3px solid var(--glow);
  border-radius: 26px;
  padding: 26px 26px 22px;
  box-shadow: 0 16px 50px rgb(40 80 110 / 0.2);
  animation: pop 0.25s cubic-bezier(0.3, 1.4, 0.5, 1);
}
@keyframes pop {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
}
.panel h2 {
  margin: 0 0 14px;
  font-size: 26px;
  font-weight: 800;
  color: var(--ink-strong);
}
.muted {
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 14px;
}
.empty-board {
  border: 2px dashed var(--tile-edge);
  border-radius: 16px;
  padding: 26px;
  text-align: center;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 18px;
}
.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-top: 2px solid #eef0f3;
  font-weight: 700;
  font-size: 18px;
  color: var(--ink-strong);
}
.toggle-row:last-of-type {
  margin-bottom: 18px;
}
.switch {
  appearance: none;
  width: 54px;
  height: 32px;
  border-radius: 999px;
  background: #d5d9de;
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
}
.switch::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.2);
  transition: transform 0.18s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.switch:checked {
  background: var(--glow);
}
.switch:checked::after {
  transform: translateX(22px);
}
.pill-btn {
  width: 100%;
  padding: 14px;
  border-radius: 999px;
  border: 3px solid var(--tile-edge);
  background: #fff;
  font-weight: 800;
  font-size: 18px;
  color: var(--ink-strong);
  cursor: pointer;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.pill-btn:hover,
.pill-btn:focus-visible {
  border-color: var(--glow);
  box-shadow: 0 0 0 4px var(--glow-soft);
  outline: none;
}

/* ---------- channel preview ---------- */

/* the menu and dock zoom toward the picked tile, speeding up as they go, while the screen dims */
.menu,
.dock {
  transition: transform 0.32s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.zoomed .menu,
.zoomed .dock {
  transform: scale(1.5);
  transition: transform 0.25s cubic-bezier(0.5, 0.1, 0.75, 0.6);
}
.stage {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgb(0 0 0 / 0);
  transition: background 0.3s ease-out;
}
.stage.dim {
  /* ease-in: about 20% dark at 100ms, 60% at 166ms, black by ~230ms */
  transition: background 0.23s cubic-bezier(0.55, 0.085, 0.68, 0.53);
}
.stage.dim {
  background: #000;
}
.stage.leaving {
  background: #000;
}
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--screen-bg);
  color: var(--screen-ink);
  /* starts sitting on top of its tile (see screenAtTile) and grows to fill the screen */
  border-radius: calc(18px / var(--s, 1));
  opacity: 0;
  transform: translate(var(--tx, 0), var(--ty, 0)) scale(var(--s, 0.34));
  transition:
    transform 0.22s cubic-bezier(0.55, 0, 0.9, 0.45),
    opacity 0.12s ease 0.1s,
    border-radius 0.22s ease-in;
}
.stage.show .screen {
  opacity: 1;
  transition:
    transform 0.22s cubic-bezier(0.55, 0, 0.9, 0.45),
    opacity 0.06s ease,
    border-radius 0.22s ease-in;
}
.stage.open .screen {
  opacity: 1;
  transform: none;
  border-radius: 0;
  /* symmetric ease-in-out from the tile to full screen, about 180ms to 420ms */
  transition:
    transform 0.24s cubic-bezier(0.45, 0, 0.55, 1),
    opacity 0.06s ease,
    border-radius 0.24s ease;
}
.stage.leaving .screen {
  opacity: 0;
  transition: opacity 0.4s ease;
}
.screen-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4vh 9vw 3vh;
  transition:
    transform 0.18s ease,
    opacity 0.18s ease;
}
.screen-body.out-left,
.screen-body.in-left {
  transform: translateX(-60px);
  opacity: 0;
}
.screen-body.out-right,
.screen-body.in-right {
  transform: translateX(60px);
  opacity: 0;
}
.screen-body.in-left,
.screen-body.in-right {
  transition: none;
}
.screen-art {
  position: relative;
  flex: none;
  width: min(960px, 100%);
  aspect-ratio: 16 / 6.5;
  border-radius: 26px;
  overflow: hidden;
  box-shadow: 0 0 0 3px rgb(255 255 255 / 0.5);
}
.screen-art .art {
  padding: 4% 5%;
}
.screen-art .art-title {
  font-size: clamp(26px, 4.4vw, 54px);
}
.screen-art .serif {
  font-size: clamp(32px, 5vw, 64px);
}
.screen-art .art-real .bubble {
  font-size: clamp(12px, 1.8vw, 22px);
}
.screen-art .art-snippets .line {
  height: clamp(8px, 1vw, 14px);
}
.screen-art .art-snippets .paper {
  inset: 14% 40% auto 5%;
}
.info {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 28px;
  margin-top: 24px;
}
.about h1 {
  margin: 0 0 8px;
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 800;
  line-height: 1.1;
}
.pitch {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.45;
  opacity: 0.9;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  padding: 6px 14px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.9);
  color: var(--ink-strong);
  font-weight: 700;
  font-size: 14px;
}
.how {
  background: rgb(255 255 255 / 0.92);
  color: var(--ink-strong);
  border-radius: 22px;
  padding: 18px 22px;
}
.how h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 800;
}
.how ol {
  margin: 0;
  padding-left: 1.3em;
  font-weight: 600;
  line-height: 1.45;
}
.how li {
  margin: 6px 0;
}

/* the light gray bar along the bottom with Menu and Start */
.screen-bar {
  flex: none;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(16px, 4vw, 60px);
  margin: 0 1.5vw;
  padding: 22px 16px calc(24px + env(safe-area-inset-bottom));
  background: linear-gradient(#f4f5f6, #d9dde1);
  border-radius: 60px 60px 0 0 / 34px 34px 0 0;
  box-shadow:
    inset 0 2px 0 #fff,
    0 -3px 14px rgb(0 0 0 / 0.25);
}
.bar-btn {
  min-width: min(280px, 38vw);
  padding: 16px 24px;
  border-radius: 999px;
  border: 3px solid #9cd6ec;
  background: linear-gradient(#ffffff, #eef1f3);
  font-weight: 700;
  font-size: 24px;
  color: #3b4048;
  cursor: pointer;
  box-shadow: 0 2px 4px rgb(0 0 0 / 0.12);
  transition:
    transform 0.18s cubic-bezier(0.3, 1.5, 0.5, 1),
    border-color 0.15s,
    box-shadow 0.15s;
}
.bar-btn:hover,
.bar-btn:focus-visible {
  border-color: var(--glow);
  box-shadow:
    0 0 0 5px var(--glow-soft),
    0 2px 4px rgb(0 0 0 / 0.12);
  transform: scale(1.05);
  outline: none;
}
.bar-btn:active {
  transform: scale(0.97);
}

/* channel arrows, fading in once the screen has landed */
.arrow {
  position: absolute;
  top: 42%;
  width: 54px;
  height: 64px;
  border: none;
  background: none;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.3s ease,
    transform 0.15s;
}
.arrow::before {
  content: '';
  position: absolute;
  inset: 14px 16px;
  background: #34bded;
  filter: drop-shadow(0 0 6px rgb(52 189 237 / 0.7));
  clip-path: polygon(100% 0, 0 50%, 100% 100%);
}
.arrow.prev {
  left: 2vw;
}
.arrow.next {
  right: 2vw;
}
.arrow.next::before {
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.stage.settled .arrow {
  opacity: 1;
  transition:
    opacity 0.15s ease,
    transform 0.15s;
  pointer-events: auto;
}
.arrow:hover {
  transform: scale(1.15);
}
.arrow:active {
  transform: scale(0.9);
}

/* ---------- avatars ---------- */

.avatar {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: #fff;
}
.avatar img {
  position: absolute;
  height: auto;
  pointer-events: none;
  user-select: none;
}

.art-mog {
  background: #34bded;
  color: #fff;
  align-items: center;
  justify-content: center;
  gap: 6%;
}
.tile-face {
  width: 46%;
  border-radius: 22%;
  box-shadow: 0 0 0 3px rgb(255 255 255 / 0.85);
}
.art-mog .art-title {
  text-align: center;
}
.screen-art .art-mog {
  flex-direction: row;
  gap: 5%;
}
.screen-art .tile-face {
  width: 26%;
}

.panel .credit {
  margin: -6px 0 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.panel .credit a {
  color: inherit;
}

/* ---------- live hands ---------- */

.hands {
  position: fixed;
  inset: 0;
  z-index: 25;
  pointer-events: none;
  overflow: hidden;
}
.hand {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  transition:
    transform 0.09s linear,
    opacity 0.5s ease;
  will-change: transform;
}
.hand.shown {
  opacity: 1;
  transition:
    transform 0.09s linear,
    opacity 0.15s ease;
}
.glove {
  display: block;
  width: 38px;
  /* the fingertip is the point */
  translate: -14px -1px;
  filter: drop-shadow(1px 3px 2px rgb(0 0 0 / 0.3));
  transition: scale 0.08s ease;
  transform-origin: 14px 1px;
}
.hand.down .glove {
  scale: 0.9;
}
.my-hand {
  position: fixed;
  z-index: 1000;
  transition: opacity 0.12s ease;
  pointer-events: none;
}
.my-hand.shown {
  transition: opacity 0.12s ease;
}
.hand-cursor,
.hand-cursor * {
  cursor: none !important;
}
.hand-cursor input,
.hand-cursor textarea {
  cursor: text !important;
}
.hand-tag {
  position: absolute;
  left: 28px;
  top: 30px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 3px;
  border-radius: 999px;
  background: hsl(var(--hue) 75% 50%);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.2);
}
.hand-tag span {
  padding-left: 4px;
}
.hand-face {
  width: 24px;
  border-radius: 50%;
}
.tap-ripple {
  position: absolute;
  width: 0;
  height: 0;
}
.tap-ripple::before {
  content: '';
  position: absolute;
  left: -30px;
  top: -30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 4px solid hsl(var(--hue) 75% 50%);
  animation: ripple 0.9s ease-out forwards;
}
.tap-face {
  position: absolute;
  left: -16px;
  top: -16px;
  width: 32px;
  border-radius: 50%;
  animation: fade 0.9s ease reverse forwards;
}
@keyframes ripple {
  from {
    scale: 0.3;
    opacity: 1;
  }
  to {
    scale: 1.4;
    opacity: 0;
  }
}
.here {
  position: absolute;
  left: calc(max(4vw, 20px) + 110px);
  top: 70px;
  display: flex;
  align-items: center;
}
.here-face,
.here-more {
  width: 38px;
  height: 38px;
  margin-left: -8px;
  border-radius: 50%;
  border: 3px solid hsl(var(--hue, 200) 75% 50%);
  background: #fff;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  color: var(--ink);
}
.here-face:first-child {
  margin-left: 0;
}
.here-face .avatar {
  width: 100%;
}
.here-more {
  border-color: var(--tile-edge);
}
@media (max-width: 700px) {
  .here {
    left: 92px;
    top: 52px;
  }
  .here-face,
  .here-more {
    width: 30px;
    height: 30px;
  }
}

/* ---------- open rooms ---------- */

.rooms {
  width: min(960px, 100%);
  margin-top: 24px;
}
.rooms h2 {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 800;
}
.rooms-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.room {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px 10px 10px;
  border-radius: 20px;
  border: 3px solid transparent;
  background: rgb(255 255 255 / 0.94);
  color: var(--ink-strong);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.15s,
    transform 0.15s;
}
.room:hover,
.room:focus-visible {
  border-color: var(--glow);
  transform: scale(1.01);
  outline: none;
}
.room-host {
  width: 56px;
  flex: none;
  border-radius: 14px;
}
.room-host.blank {
  aspect-ratio: 1;
  background: #eef0f3;
}
.room-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.room-info strong {
  font-size: 19px;
  font-weight: 800;
}
.room-info span {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}
.room-faces {
  display: flex;
}
.room-face {
  width: 30px;
  margin-left: -6px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #fff;
}
.no-rooms {
  margin: 0;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgb(255 255 255 / 0.2);
  font-weight: 700;
}
.room-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  padding: 3px 10px;
  border-radius: 999px;
  background: #22c55e;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.2);
  animation: pop 0.3s ease;
}

/* ---------- tutorial ---------- */

.tutorial .channel:not([data-id='mog']):not(.empty) {
  filter: grayscale(1);
  opacity: 0.35;
}
.tutorial .channel:not([data-id='mog']):hover {
  transform: none;
  border-color: var(--tile-edge);
  box-shadow: none;
}
.tutorial .channel[data-id='mog'] {
  border-color: var(--glow);
  animation: beacon 1.6s ease-in-out infinite;
  z-index: 3;
}
@keyframes beacon {
  50% {
    box-shadow: 0 0 0 10px var(--glow-soft);
  }
}
.tutorial .round-btn.right {
  opacity: 0.4;
}
.tutorial .arrow {
  display: none;
}
.coach {
  position: absolute;
  z-index: 4;
  transform: translate(-50%, calc(-100% - 14px));
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--glow);
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgb(20 120 170 / 0.3);
  pointer-events: none;
  animation: bob 1.6s ease-in-out infinite;
}
.coach::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -8px;
  border: 9px solid transparent;
  border-bottom: 0;
  border-top-color: var(--glow);
  transform: translateX(-50%);
}
@keyframes bob {
  50% {
    translate: 0 -6px;
  }
}
.wiggle {
  animation: wiggle 0.45s ease !important;
}
@keyframes wiggle {
  20% {
    rotate: -4deg;
  }
  40% {
    rotate: 4deg;
  }
  60% {
    rotate: -3deg;
  }
  80% {
    rotate: 2deg;
  }
}
.toast {
  position: fixed;
  left: 50%;
  top: calc(24px + env(safe-area-inset-top));
  z-index: 50;
  translate: -50% 0;
  padding: 14px 26px;
  border-radius: 999px;
  background: #fff;
  border: 3px solid var(--glow);
  font-weight: 800;
  font-size: 20px;
  color: var(--ink-strong);
  box-shadow: 0 10px 30px rgb(40 80 110 / 0.2);
  pointer-events: none;
}
.toast.show {
  animation: toast 3.2s ease both;
}
@keyframes toast {
  0% {
    opacity: 0;
    translate: -50% -20px;
  }
  10%,
  85% {
    opacity: 1;
    translate: -50% 0;
  }
  100% {
    opacity: 0;
    translate: -50% -10px;
  }
}

/* ---------- who's playing ---------- */

.wall {
  position: fixed;
  inset: 0;
  z-index: 45;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(6vh + env(safe-area-inset-top)) 4vw 6vh;
  background-color: var(--bg);
  background-image: repeating-linear-gradient(0deg, var(--stripe) 0 2px, transparent 2px 6px);
  animation: fade 0.3s ease;
}
.wall.leaving {
  opacity: 0;
  transition: opacity 0.35s ease;
}
.wall-title {
  margin: 0 0 4vh;
  font-size: clamp(30px, 5vw, 52px);
  font-weight: 800;
  color: var(--ink-strong);
}
.wall-people {
  width: min(1000px, 100%);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: clamp(12px, 2vw, 24px);
}
.person {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 10px 12px;
  border-radius: 24px;
  border: 3px solid var(--tile-edge);
  background: #fff;
  cursor: pointer;
  font: inherit;
  animation: pop 0.35s cubic-bezier(0.3, 1.4, 0.5, 1) both;
  transition:
    transform 0.18s cubic-bezier(0.3, 1.5, 0.5, 1),
    border-color 0.15s,
    box-shadow 0.15s;
}
.person:nth-child(2) {
  animation-delay: 0.04s;
}
.person:nth-child(3) {
  animation-delay: 0.08s;
}
.person:nth-child(n + 4) {
  animation-delay: 0.12s;
}
.person:hover,
.person:focus-visible {
  border-color: var(--glow);
  box-shadow: 0 0 0 5px var(--glow-soft);
  transform: scale(1.06);
  outline: none;
}
.person.picked {
  transform: scale(0.96);
  border-color: var(--glow);
}
.person-face {
  width: 100%;
  border-radius: 20px;
}
.person-face.blank {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: #eef0f3;
  font-weight: 800;
  font-size: 26px;
  color: var(--muted);
}
.person-face.plus {
  font-size: 54px;
  color: var(--glow);
  background: rgb(52 189 237 / 0.12);
}
.person-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
  font-size: 18px;
  color: var(--ink-strong);
}

.player-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 0 14px;
}
.player-face {
  width: 64px;
  flex: none;
  border-radius: 16px;
  box-shadow: 0 0 0 3px var(--tile-edge);
}
.player-face.blank {
  aspect-ratio: 1;
  background: #eef0f3;
}
.player-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.player-info strong {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.muted-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.pill-btn.small {
  width: auto;
  padding: 10px 18px;
  font-size: 16px;
}

/* ---------- face maker ---------- */

.maker {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  background-image: repeating-linear-gradient(0deg, var(--stripe) 0 2px, transparent 2px 6px);
  animation: fade 0.25s ease;
}
.maker-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: auto minmax(300px, 520px);
  justify-content: center;
  gap: clamp(20px, 4vw, 56px);
  padding: 3vh 4vw 2vh;
}
.maker-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-height: 0;
}
.maker-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  color: var(--ink-strong);
}
.maker-name input {
  width: 200px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 3px solid var(--tile-edge);
  background: #fff;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink-strong);
  outline: none;
  user-select: text;
}
.maker-name input:focus {
  border-color: var(--glow);
  box-shadow: 0 0 0 4px var(--glow-soft);
}
.canvas-wrap {
  position: relative;
}
.maker-canvas {
  --size: min(56vh, 46vw, 520px);
  position: relative;
  width: var(--size);
  height: var(--size);
  border-radius: 28px;
  background: #fff;
  border: 4px solid var(--tile-edge);
  overflow: hidden;
  touch-action: none;
  cursor: default;
}
.maker-empty {
  position: absolute;
  inset: 0;
  margin: 0;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
  color: var(--muted);
  pointer-events: none;
}
.sticker {
  position: absolute;
  cursor: grab;
  line-height: 0;
}
.sticker:active {
  cursor: grabbing;
}
.sticker img {
  width: 100%;
  height: auto;
  pointer-events: none;
}
.sticker.sel {
  outline: 2px dashed var(--glow);
  outline-offset: 2px;
  border-radius: 6px;
}
.knob {
  position: absolute;
  right: -14px;
  bottom: -14px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--glow);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.3);
  cursor: nwse-resize;
}
.tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 64px;
  padding: 8px 10px;
  border-radius: 16px;
  border: 3px solid var(--tile-edge);
  background: #fff;
  font-size: 20px;
  line-height: 1;
  color: var(--ink-strong);
  cursor: pointer;
  transition:
    border-color 0.15s,
    transform 0.15s;
}
.tool span {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
}
.tool:hover:not(:disabled) {
  border-color: var(--glow);
}
.tool:active:not(:disabled) {
  transform: scale(0.95);
}
.tool:disabled {
  opacity: 0.4;
  cursor: default;
}
.maker-hint {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}
.palette {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  min-width: 0;
  background: #fff;
  border: 3px solid var(--tile-edge);
  border-radius: 26px;
  padding: 14px;
}
.search {
  padding: 12px 16px;
  border-radius: 999px;
  border: 3px solid var(--tile-edge);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-strong);
  outline: none;
  user-select: text;
}
.search:focus {
  border-color: var(--glow);
}
.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 3px solid transparent;
  background: #f1f3f5;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.tab img {
  width: 26px;
}
.tab.on {
  border-color: var(--glow);
  background: #fff;
}
.emo-grid {
  position: relative; /* so section markers measure from the top of the list */
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  align-content: start;
  gap: 4px;
}
.emo {
  aspect-ratio: 1;
  border: none;
  border-radius: 12px;
  background: none;
  cursor: pointer;
  padding: 7px;
  transition:
    background 0.1s,
    transform 0.12s;
}
.emo img {
  width: 100%;
}
.emo:hover {
  background: #eef0f3;
  transform: scale(1.12);
}
.emo:active {
  transform: scale(0.9);
}
.emo-section {
  grid-column: 1 / -1;
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 6px 0 2px;
  padding: 6px 4px;
  background: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.emo-anchor {
  grid-column: 1 / -1;
  height: 0;
}
.emo-anchor:first-child + .emo-section {
  margin-top: 0;
}
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  font-weight: 700;
  color: var(--muted);
}

/* ---------- phones ---------- */

@media (max-width: 700px) {
  :root {
    --dock-h: 116px;
  }
  html,
  body {
    overflow: auto;
  }
  .menu {
    position: relative; /* still the reference for the tutorial bubble */
    display: block;
    min-height: 100dvh;
    padding: calc(20px + env(safe-area-inset-top)) 16px calc(var(--dock-h) + 24px);
  }
  .channels {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .channel {
    aspect-ratio: 5 / 4;
  }
  .channel:nth-child(n + 7) {
    display: none;
  }
  .channel:not(.empty):hover {
    transform: none;
  }
  .art-title {
    font-size: 14px;
  }
  .serif {
    font-size: 19px;
  }
  .art-real .bubble {
    font-size: 9px;
  }
  .time {
    font-size: 36px;
  }
  .date {
    font-size: 14px;
    margin-top: 2px;
  }
  .clock {
    top: 16%;
  }
  .round-btn {
    width: 62px;
    height: 62px;
    top: 34px;
  }
  .round-label {
    font-size: 15px;
  }
  .round-btn svg {
    width: 30px;
  }
  .screen-body {
    padding: calc(16px + env(safe-area-inset-top)) 16px 16px;
  }
  .screen-art {
    aspect-ratio: 16 / 9;
    border-radius: 20px;
  }
  .info {
    grid-template-columns: 1fr;
    gap: 18px;
    margin-top: 18px;
  }
  .pitch {
    font-size: 16px;
  }
  .screen-bar {
    gap: 12px;
    margin: 0;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    border-radius: 34px 34px 0 0 / 22px 22px 0 0;
  }
  .bar-btn {
    flex: 1;
    min-width: 0;
    padding: 14px 12px;
    font-size: 19px;
  }
  .maker-main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 12px;
    padding: calc(12px + env(safe-area-inset-top)) 12px 8px;
  }
  .maker-stage {
    gap: 8px;
  }
  .maker-canvas {
    --size: min(86vw, 40vh);
    border-radius: 22px;
  }
  .maker-name input {
    width: 150px;
    padding: 8px 14px;
    font-size: 16px;
  }
  .tools {
    gap: 6px;
  }
  .tool {
    min-width: 0;
    flex: 1;
    padding: 6px 4px;
    font-size: 17px;
  }
  .maker-hint {
    display: none;
  }
  .palette {
    padding: 10px;
    border-radius: 20px;
  }
  .search {
    padding: 9px 14px;
  }
  .emo-grid {
    grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  }
  .arrow {
    top: 20%;
    width: 40px;
    height: 52px;
  }
  .arrow.prev {
    left: 0;
  }
  .arrow.next {
    right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition: none !important;
  }
}
