@font-face {
  font-family: "Paper Hand";
  src: url("./assets/fonts/PatrickHand-Regular.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Marker Display";
  src: url("./assets/fonts/PermanentMarker-Regular.woff2") format("woff2");
  font-display: swap;
}

:root {
  color-scheme: light;
  --note: #f3ead6;
  --note-light: #fffaf0;
  --note-dark: #d8ccb3;
  --ink: #2b2823;
  --home: #2f5fb5;
  --away: #c0392b;
  --paper: #f3ead6;
  --paper-light: #fffaf0;
  --paper-edge: #cdbb98;
  --graphite: #565149;
  --pen-blue: #2f5fb5;
  --pen-red: #c0392b;
  --marker: #26231f;
  --sticky: #ffe9a6;
  --tape: rgba(226, 208, 150, 0.82);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --tray-h: calc(150px + var(--safe-bottom));
  --juice: #ee8a2a;
  --gold: #c99a1e;
  font-family: "Paper Hand", "Comic Sans MS", cursive;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

html,
body {
  position: fixed;
  inset: 0;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-text-size-adjust: 100%;
}

body {
  background: radial-gradient(circle at 50% 35%, #fffaf0 0%, #f3ead6 66%, #d8ccb3 100%);
  color: var(--ink);
}

#app {
  position: relative;
  isolation: isolate;
  background: var(--paper);
}

@media (orientation: landscape) and (pointer: fine) {
  #app {
    width: min(100vw, 62vh);
    margin: 0 auto;
    box-shadow: 0 0 0 2px rgba(86, 81, 73, 0.3), 0 0 40px rgba(86, 81, 73, 0.25);
  }
}

#gameCanvas {
  position: absolute;
  top: 0;
  right: 0;
  bottom: var(--tray-h);
  left: 0;
  display: block;
  width: 100%;
  height: calc(100% - var(--tray-h));
  outline: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

#interface {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

#status {
  position: absolute;
  top: calc(74px + var(--safe-top));
  right: auto;
  bottom: auto;
  left: var(--safe-center, 50%);
  width: min(520px, calc(100% - 28px - var(--safe-left) - var(--safe-right)));
  margin: 0;
  padding: 5px 14px;
  border: 2px solid rgba(86, 81, 73, 0.5);
  border-radius: 4px;
  background: rgba(255, 250, 240, 0.9);
  box-shadow: 2px 3px 0 rgba(86, 81, 73, 0.18);
  font-size: clamp(11px, 2.6vw, 14px);
  line-height: 1.05;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  transform: translateX(-50%) rotate(-0.4deg);
  white-space: nowrap;
}

#hikeButton,
#puntButton,
#kickButton,
#twoButton {
  border: 2px solid var(--marker);
  border-radius: 4px 10px 6px 8px;
  background: linear-gradient(180deg, #fff3c9, var(--sticky) 72%, #efd98c);
  color: var(--marker);
  font-family: "Marker Display", "Paper Hand", cursive;
  text-shadow: none;
  box-shadow: 3px 4px 0 rgba(86, 81, 73, 0.24);
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

#hikeButton {
  position: absolute;
  right: auto;
  bottom: calc(var(--tray-h) + 10px);
  left: calc(var(--safe-center, 50%) + 92px);
  min-width: 150px;
  min-height: 68px;
  padding: 12px 22px;
  transform: translateX(-50%) rotate(-1.2deg);
  font-size: clamp(20px, 5.8vw, 28px);
}

#puntButton {
  position: absolute;
  right: auto;
  bottom: calc(var(--tray-h) + 10px);
  left: calc(var(--safe-center, 50%) - 92px);
  min-width: 140px;
  min-height: 68px;
  padding: 12px 20px;
  transform: translateX(-50%) rotate(1.2deg);
  font-size: clamp(18px, 5vw, 25px);
}

/* Auto defense: the AUTO sticky note, SAME CALL, and the fan of 5 calls. */
#autoCallButton,
#sameCallButton {
  position: absolute;
  bottom: calc(var(--tray-h) + 10px);
  display: grid;
  place-items: center;
  gap: 1px;
  min-width: 132px;
  min-height: 62px;
  padding: 8px 16px 7px;
  border: 2px solid var(--marker);
  border-radius: 4px 10px 6px 8px;
  background: linear-gradient(180deg, #fff3c9, var(--sticky) 72%, #efd98c);
  color: var(--marker);
  font-family: "Marker Display", "Paper Hand", cursive;
  box-shadow: 3px 4px 0 rgba(86, 81, 73, 0.24);
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

#autoCallButton[hidden],
#sameCallButton[hidden] {
  display: none;
}

#autoCallButton {
  left: calc(var(--safe-center, 50%) - 84px);
  transform: translateX(-50%) rotate(1.4deg);
}

#sameCallButton {
  left: calc(var(--safe-center, 50%) + 84px);
  min-width: 128px;
  background: linear-gradient(180deg, #fffaf0, #f4efe2 72%, #e6dfcd);
  transform: translateX(-50%) rotate(-1.2deg);
}

#autoCallButton span,
#sameCallButton span {
  font-size: clamp(19px, 5.4vw, 25px);
  line-height: 1;
}

#autoCallButton small,
#sameCallButton small {
  font-family: "Paper Hand", cursive;
  font-size: 13px;
  line-height: 1;
  opacity: 0.72;
}

#autoCallButton:active,
#sameCallButton:active {
  translate: 0 2px;
  box-shadow: 1px 2px 0 rgba(86, 81, 73, 0.24);
}

#callFan {
  position: absolute;
  left: var(--safe-center, 50%);
  bottom: calc(var(--tray-h) + 82px);
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 12px;
  width: min(372px, calc(100% - 32px - var(--safe-left) - var(--safe-right)));
  transform: translateX(-50%);
  pointer-events: auto;
}

#callFan[hidden] {
  display: none;
}

.callNote {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  justify-items: center;
  width: calc((100% - 24px) / 3);
  min-height: 132px;
  padding: 7px 6px 8px;
  border: 1.5px solid rgba(38, 35, 31, 0.75);
  border-radius: 3px 8px 5px 7px;
  background: linear-gradient(180deg, #fff6d2, var(--sticky) 70%, #f1dc93);
  color: var(--marker);
  box-shadow: 2px 3px 0 rgba(86, 81, 73, 0.22);
  font-family: "Paper Hand", cursive;
  text-align: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transform-origin: 50% 120%;
  transform: rotate(var(--tilt, 0deg));
  animation: callNoteIn 160ms cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
  animation-delay: var(--delay, 0ms);
}

.callNote:active {
  translate: 0 2px;
  box-shadow: 1px 1px 0 rgba(86, 81, 73, 0.22);
}

.callNote b {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 17px;
  font-weight: 400;
  line-height: 1;
}

.callNote em {
  font-size: 12px;
  font-style: normal;
  line-height: 1.1;
  opacity: 0.7;
}

.callNote .callDiagram {
  width: 84px;
  height: 52px;
  margin: 2px 0 1px;
}

.callNote span {
  font-size: 12px;
  line-height: 1.05;
}

@keyframes callNoteIn {
  from {
    opacity: 0;
    transform: translateY(26px) rotate(0deg) scale(0.86);
  }
}

#hikeButton:active,
#puntButton:active {
  transform: translateX(-50%) rotate(0deg) translateY(2px);
  box-shadow: 1px 2px 0 rgba(86, 81, 73, 0.24);
}

#kickButton:active,
#twoButton:active {
  transform: translateY(2px);
  box-shadow: 1px 2px 0 rgba(86, 81, 73, 0.24);
}

#hikeButton.left,
#puntButton.left {
  transform: translateX(-50%) rotate(-1.2deg);
}

#hikeButton.right,
#puntButton.right {
  transform: translateX(-50%) rotate(1.2deg);
}

#turboButton {
  position: absolute;
  right: calc(18px + var(--safe-right));
  bottom: calc(var(--tray-h) + 10px);
  width: 104px;
  height: 78px;
  padding: 0;
  border: 2px solid var(--marker);
  border-radius: 46% 54% 50% 50%;
  background: linear-gradient(180deg, #ffd9a8, #f4b76b 70%, #e09a4a);
  color: var(--marker);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 17px;
  pointer-events: auto;
  touch-action: none;
  box-shadow: 3px 4px 0 rgba(86, 81, 73, 0.24);
}

#turboButton.active {
  transform: scale(0.94) rotate(-2deg);
  box-shadow: 2px 2px 0 rgba(86, 81, 73, 0.26);
}

#turboButton[hidden] {
  display: none;
}

#hikeButton:focus-visible,
#puntButton:focus-visible,
#turboButton:focus-visible,
#kickButton:focus-visible,
#twoButton:focus-visible {
  outline: 3px dashed var(--pen-blue);
  outline-offset: 4px;
}

#patChoice {
  position: absolute;
  right: calc(18px + var(--safe-right));
  bottom: calc(var(--tray-h) + 12px);
  left: calc(18px + var(--safe-left));
  z-index: 4;
  padding: 16px;
  border: 2px solid var(--marker);
  border-radius: 4px;
  background: rgba(255, 250, 240, 0.96);
  text-align: center;
  pointer-events: auto;
  box-shadow: 4px 5px 0 rgba(86, 81, 73, 0.24);
}

#patChoice strong {
  display: block;
  margin-bottom: 12px;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: clamp(17px, 5vw, 24px);
}

#patChoice div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

#kickButton,
#twoButton {
  min-height: 56px;
  font-size: clamp(15px, 4.5vw, 21px);
  background: linear-gradient(180deg, #f2f7ff, #dce9fb 72%, #bcd3ee);
}

#patChoice[hidden],
#puntButton[hidden],
#hikeButton[hidden] {
  display: none;
}

#safeProbe {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: var(--safe-top);
  box-sizing: content-box;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  padding-bottom: var(--safe-bottom);
  pointer-events: none;
}

/* Hidden unless JS has confirmed a real landscape viewport for 300ms after a resize. */
#rotateHint {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 32px;
  background: var(--paper);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: clamp(24px, 7vw, 42px);
  text-align: center;
}

#app.landscape #rotateHint {
  display: grid;
}

#app.landscape #interface,
#app.menu-open #interface {
  visibility: hidden;
}

.menuOverlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: calc(20px + var(--safe-top)) calc(18px + var(--safe-right)) calc(20px + var(--safe-bottom)) calc(18px + var(--safe-left));
  background: rgba(226, 216, 196, 0.86);
}

#mainMenu[hidden],
#multiplayerLobby[hidden],
#multiplayerBanner[hidden] {
  display: none;
}

.menuCard {
  position: relative;
  width: min(620px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: clamp(18px, 4vw, 34px);
  border: 2px solid var(--marker);
  border-radius: 4px 8px 6px 10px;
  background: #fffaf0;
  box-shadow: 6px 7px 0 rgba(86, 81, 73, 0.2);
  text-align: center;
}

.menuCard::before,
.menuCard::after {
  position: absolute;
  width: 92px;
  height: 26px;
  background: var(--tape);
  border: 1px solid rgba(140, 122, 74, 0.35);
  content: "";
}

.menuCard::before {
  top: -12px;
  left: -22px;
  transform: rotate(-7deg);
}

.menuCard::after {
  right: -22px;
  bottom: -12px;
  transform: rotate(6deg);
}

.menuKicker {
  margin: 0 0 6px;
  color: var(--pen-blue);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 13px;
  letter-spacing: 0.08em;
}

.menuCard h1 {
  margin: 0 0 18px;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: clamp(24px, 6vw, 42px);
}

.menuCard p {
  margin: 8px 0 14px;
  font-size: clamp(13px, 3.5vw, 18px);
  line-height: 1.25;
}

.menuCard button,
.menuCard input {
  width: 100%;
  min-height: 54px;
  margin: 6px 0;
  border: 2px solid var(--marker);
  border-radius: 4px 10px 6px 8px;
  background: linear-gradient(180deg, #fff3c9, var(--sticky) 72%, #efd98c);
  color: var(--marker);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: clamp(15px, 4vw, 22px);
  text-shadow: none;
  pointer-events: auto;
}

.menuCard button:active {
  transform: translateY(2px) rotate(-0.6deg);
  box-shadow: 2px 2px 0 rgba(86, 81, 73, 0.2);
}

.menuCard input {
  padding: 8px 12px;
  background: #fffdf6;
  text-overflow: ellipsis;
  text-shadow: none;
}

.menuCard input:focus-visible {
  outline: 3px dashed var(--pen-blue);
  outline-offset: 3px;
}

.roomCode {
  margin: 4px 0 10px !important;
  color: var(--pen-red);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: clamp(20px, 5vw, 30px) !important;
  letter-spacing: 0.1em;
}

.menuNote {
  margin: 0 0 14px;
  font-size: clamp(12px, 3.2vw, 16px);
  opacity: 0.78;
}

#quickPlayOverlay[hidden],
#resultScreen[hidden],
#quickJoinButton[hidden] {
  display: none;
}

#quickJoinButton {
  position: absolute;
  top: calc(120px + var(--safe-top));
  right: calc(18px + var(--safe-right));
  z-index: 12;
  min-height: 56px;
  padding: 10px 16px;
  border: 2px solid var(--marker);
  border-radius: 4px 10px 6px 8px;
  background: linear-gradient(180deg, #fff3c9, var(--sticky) 72%, #efd98c);
  color: var(--marker);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 14px;
  box-shadow: 3px 4px 0 rgba(86, 81, 73, 0.24);
  pointer-events: auto;
}

.resultOverlay {
  background: rgba(226, 216, 196, 0.78);
}

.resultCard {
  width: min(520px, 100%);
}

.resultCard .resultTitle {
  margin: 0 0 6px;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: clamp(46px, 16vw, 92px);
  line-height: 1;
  transform: rotate(-1.6deg);
}

.result-win {
  color: var(--pen-blue);
}

.result-loss {
  color: var(--pen-red);
}

.result-draw {
  color: var(--graphite);
}

.resultCard .resultScore {
  margin: 0 0 18px;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: clamp(18px, 5.4vw, 28px);
  letter-spacing: 0.06em;
}

.resultButtons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.resultButtons button:disabled {
  opacity: 0.55;
  filter: grayscale(0.25);
}

.resultHint {
  margin: 10px 0 0;
  font-size: clamp(12px, 3.4vw, 16px);
  opacity: 0.7;
}

.resultHint[hidden] {
  display: none;
}

.resultButtons button {
  width: auto;
  min-width: 150px;
  margin: 0;
}

@media (max-height: 460px) {
  .menuCard {
    padding: 8px 12px;
  }

  .menuKicker {
    margin-bottom: 0;
    font-size: 10px;
  }

  .menuCard h1 {
    margin: 2px 0 4px;
    font-size: clamp(18px, 4.6vw, 26px);
  }

  .menuCard p,
  .menuNote {
    margin: 2px 0 6px;
    font-size: clamp(11px, 3vw, 14px);
  }

  .menuCard button,
  .menuCard input {
    min-height: 40px;
    margin: 2px 0;
    padding: 4px 10px;
    font-size: clamp(14px, 3.8vw, 20px);
  }

  .roomCode {
    margin: 2px 0 6px !important;
    font-size: clamp(17px, 4.4vw, 24px) !important;
  }

  .resultCard .resultTitle {
    font-size: clamp(52px, 17vw, 88px);
  }

  .resultCard .resultScore {
    margin-bottom: 10px;
    font-size: clamp(17px, 5vw, 26px);
  }

  .resultButtons button {
    min-width: 132px;
    min-height: 48px;
  }

  #quickJoinButton {
    min-height: 46px;
    font-size: 13px;
  }
}

#multiplayerBanner {
  position: absolute;
  top: calc(200px + var(--safe-top));
  right: calc(16px + var(--safe-right));
  left: calc(16px + var(--safe-left));
  z-index: 9;
  padding: 10px 14px;
  border: 2px solid var(--pen-blue);
  border-radius: 4px;
  background: rgba(255, 250, 240, 0.95);
  color: var(--pen-blue);
  font-size: clamp(14px, 4vw, 20px);
  text-align: center;
  pointer-events: none;
  box-shadow: 3px 4px 0 rgba(86, 81, 73, 0.18);
}

noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--paper);
  color: var(--ink);
  font-size: 22px;
}

#cardTray {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  height: var(--tray-h);
  padding: 7px calc(8px + var(--safe-right)) calc(6px + var(--safe-bottom)) calc(8px + var(--safe-left));
  border-top: 2px solid rgba(38, 35, 31, 0.75);
  background:
    repeating-linear-gradient(0deg, rgba(47, 95, 181, 0.09) 0 1px, transparent 1px 22px),
    #f6eedb;
  box-shadow: 0 -3px 0 rgba(86, 81, 73, 0.14);
}

#app.landscape #cardTray,
#app.menu-open #cardTray {
  visibility: hidden;
}

.trayRow {
  display: flex;
  gap: 6px;
  align-items: flex-end;
}

.nextCard {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  width: 44px;
  opacity: 0.85;
}

.nextCard span {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 10px;
  letter-spacing: 0.06em;
}

#hand {
  display: flex;
  flex: 1 1 auto;
  gap: 10px;
  justify-content: center;
}

/* Each slot is as wide as its card (sized for 3), so a 2 card hand sits in the middle at the same size. */
.handCard {
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  touch-action: none;
  cursor: grab;
  transition: transform 120ms ease, filter 120ms ease, opacity 120ms ease;
  -webkit-tap-highlight-color: transparent;
}

.handCard canvas {
  display: block;
  margin: 0 auto;
  filter: drop-shadow(2px 3px 0 rgba(86, 81, 73, 0.22));
}

.handCard.armed {
  transform: translateY(-12px) rotate(-2deg);
}

.handCard.armed canvas {
  filter: drop-shadow(0 0 0 #000) drop-shadow(2px 6px 0 rgba(238, 138, 42, 0.55));
}

.handCard[hidden] {
  display: none;
}

/* Short on juice: full color, with a pencil tag saying how much more it needs. */
.handCard.short::after {
  position: absolute;
  top: 38%;
  left: 50%;
  padding: 1px 5px;
  border: 1.5px solid var(--juice);
  border-radius: 3px;
  background: rgba(255, 250, 240, 0.95);
  color: var(--marker);
  content: attr(data-need);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 10px;
  white-space: nowrap;
  transform: translate(-50%, -50%) rotate(-6deg);
  pointer-events: none;
}

.nextCard.empty canvas,
.nextCard.empty span {
  visibility: hidden;
}

#juiceBar {
  display: flex;
  gap: 7px;
  align-items: center;
  height: 24px;
  margin-top: 6px;
}

.juiceLabel {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.juiceTrack {
  position: relative;
  flex: 1 1 auto;
  height: 18px;
  overflow: hidden;
  border: 2px solid var(--marker);
  border-radius: 3px 8px 4px 7px;
  background: #fffaf0;
  transform: rotate(-0.4deg);
}

#juiceFill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 50%;
  background: repeating-linear-gradient(-45deg, var(--juice) 0 6px, #f4a34f 6px 11px);
  transition: width 140ms linear;
}

.juiceTicks {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1.5px), rgba(38, 35, 31, 0.55) calc(10% - 1.5px) 10%);
}

#juiceBar.double #juiceFill {
  background: repeating-linear-gradient(-45deg, #c0392b 0 6px, var(--juice) 6px 11px);
}

#juiceCount {
  min-width: 24px;
  color: var(--marker);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 19px;
  text-align: center;
}

#cardDetail {
  position: absolute;
  right: calc(10px + var(--safe-right));
  bottom: calc(var(--tray-h) + 86px);
  left: calc(10px + var(--safe-left));
  z-index: 5;
  display: flex;
  gap: 8px;
  align-items: stretch;
  padding: 7px 8px 7px 11px;
  border: 2px solid var(--marker);
  border-radius: 4px 9px 6px 8px;
  background: rgba(255, 250, 240, 0.97);
  box-shadow: 3px 4px 0 rgba(86, 81, 73, 0.22);
  pointer-events: auto;
  transform: rotate(-0.5deg);
}

.detailBody {
  flex: 1 1 auto;
  min-width: 0;
}

#cardDetail[hidden],
#cardRecap[hidden],
#profileScreen[hidden],
#tournamentScreen[hidden],
#cpuPicker[hidden],
#emotePicker[hidden],
.emoteBubble[hidden],
#friendsScreen[hidden],
#inviteBanner[hidden],
#friendLinkPrompt[hidden],
#roadScreen[hidden],
#leagueUp[hidden],
#packOpening[hidden],
#packSummary[hidden],
#shopScreen[hidden],
#settingsScreen[hidden],
#teamScreen[hidden],
#pauseScreen[hidden],
#playedCards[hidden],
#cardGhost[hidden],
#deckBuilder[hidden] {
  display: none;
}

#cardDetailName {
  margin-right: 6px;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 17px;
}

#cardDetailMeta {
  font-size: 12px;
  opacity: 0.8;
}

#cardDetail p {
  margin: 2px 0 0;
  font-size: 14px;
  line-height: 1.12;
}

#cardDetail .detailStats {
  font-size: 12px;
  letter-spacing: 0.03em;
  opacity: 0.85;
}

#cardDetail .detailHint {
  color: var(--pen-red);
  font-size: 13px;
}

#cardPlayButton {
  flex: 0 0 74px;
  min-height: 56px;
  margin: 0;
  border: 2px solid var(--marker);
  border-radius: 4px 10px 6px 8px;
  background: linear-gradient(180deg, #ffd9a8, #f4b76b 70%, #e09a4a);
  color: var(--marker);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 17px;
  box-shadow: 2px 3px 0 rgba(86, 81, 73, 0.22);
}

#cardPlayButton:disabled {
  opacity: 0.5;
  filter: grayscale(0.4);
}

#playedCards {
  position: absolute;
  top: calc(118px + var(--safe-top));
  right: calc(10px + var(--safe-right));
  left: calc(10px + var(--safe-left));
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.playedSlot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  visibility: hidden;
  pointer-events: none;
}

.playedSlot.show {
  visibility: visible;
  pointer-events: auto;
}

#playedCards.fading .playedSlot {
  opacity: 0;
  transition: opacity 450ms ease-in;
}

/* WON THE PLAY: a marker tag that pops onto the chip with the result under it. */
.playedSlot .chipWon,
.playedSlot .chipResult {
  display: none;
}

.playedSlot.won .chipWon {
  display: block;
  position: absolute;
  top: 18px;
  left: 50%;
  padding: 1px 6px;
  border: 2px solid var(--marker);
  border-radius: 3px 6px 4px 5px;
  background: #fff2a8;
  color: var(--marker);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 12px;
  white-space: nowrap;
  transform: translateX(-50%) rotate(-6deg);
  animation: chipWon 1.6s ease-out;
}

#myPlayed.won .chipWon {
  left: -4px;
  transform: rotate(-6deg);
  transform-origin: 0 50%;
  animation-name: chipWonLeft;
}

#theirPlayed.won .chipWon {
  right: -4px;
  left: auto;
  transform: rotate(6deg);
  transform-origin: 100% 50%;
  animation-name: chipWonRight;
}

@keyframes chipWonLeft {
  0% { opacity: 0; transform: rotate(-14deg) scale(2.4); }
  14% { opacity: 1; transform: rotate(-6deg) scale(1); }
  100% { opacity: 1; }
}

@keyframes chipWonRight {
  0% { opacity: 0; transform: rotate(14deg) scale(2.4); }
  14% { opacity: 1; transform: rotate(6deg) scale(1); }
  100% { opacity: 1; }
}

#myPlayed .chipResult {
  align-self: flex-start;
  text-align: left;
}

#theirPlayed .chipResult {
  align-self: flex-end;
  text-align: right;
}

.playedSlot.won .chipResult {
  display: block;
  max-width: 132px;
  margin-top: 2px;
  padding: 1px 5px;
  background: rgba(255, 250, 240, 0.94);
  color: var(--marker);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 10px;
  font-style: normal;
  line-height: 1.1;
  text-align: center;
}

.playedSlot.won canvas {
  animation: chipFlash 1.6s ease-out;
}

@keyframes chipWon {
  0% { opacity: 0; transform: translateX(-50%) rotate(-14deg) scale(2.4); }
  14% { opacity: 1; transform: translateX(-50%) rotate(-6deg) scale(1); }
  100% { opacity: 1; }
}

@keyframes chipFlash {
  0%, 30%, 60% { filter: drop-shadow(0 0 0 #ffd84a); transform: scale(1); }
  15%, 45% { filter: drop-shadow(0 0 7px #ffd84a); transform: scale(1.12); }
  100% { filter: none; transform: scale(1); }
}

#chipDetail {
  position: absolute;
  top: calc(196px + var(--safe-top));
  left: 50%;
  z-index: 6;
  width: min(330px, calc(100% - 28px));
  padding: 8px 12px;
  border: 2px solid var(--marker);
  border-radius: 4px 9px 6px 8px;
  background: rgba(255, 250, 240, 0.97);
  box-shadow: 2px 3px 0 rgba(86, 81, 73, 0.22);
  transform: translateX(-50%);
  pointer-events: auto;
}

#chipDetail[hidden] {
  display: none;
}

#chipDetail strong {
  display: block;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 15px;
}

#chipDetail p {
  margin: 3px 0 0;
  font-size: 14px;
  line-height: 1.15;
}

#chipDetail .chipWonLine {
  color: var(--pen-red);
}

/* The card reveal layer: flying cards and the snap slam. Never takes a touch. */
#cardReveal {
  position: fixed;
  inset: 0;
  z-index: 25;
  overflow: hidden;
  pointer-events: none;
}

.flyingCard,
.slamCard {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 50% 50%;
  will-change: transform;
}

.flyingCard canvas,
.slamCard canvas {
  display: block;
  filter: drop-shadow(3px 5px 0 rgba(86, 81, 73, 0.3));
}

.slamCard {
  transform-origin: 0 0;
}

/* The flip: face down on the way in, face up as it lands (the back sits over the front until halfway). */
.slamFlip {
  position: relative;
}

.slamFlip .slamBack {
  position: absolute;
  top: 0;
  left: 0;
}

.slamVs {
  position: absolute;
  padding: 0 10px;
  color: var(--pen-red);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 54px;
  line-height: 1;
  text-shadow: 3px 3px 0 #fffaf0, -2px -2px 0 #fffaf0, 2px -2px 0 #fffaf0, -2px 2px 0 #fffaf0;
  transform: translate(-50%, -50%) rotate(-8deg);
}

.playedSlot.flip canvas {
  animation: cardFlip 420ms ease-out;
}

@keyframes cardFlip {
  0% { transform: rotateY(90deg) scale(1.15); }
  100% { transform: rotateY(0deg) scale(1); }
}

.playedSlot span {
  margin-top: -2px;
  padding: 0 5px;
  background: rgba(255, 250, 240, 0.92);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 10px;
}

#myPlayed span {
  color: var(--pen-blue);
}

#theirPlayed span {
  color: var(--pen-red);
}

#cardGhost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
  pointer-events: none;
  opacity: 0.92;
  transform-origin: 50% 50%;
}

.deckMenuButton {
  background: linear-gradient(180deg, #f2f7ff, #dce9fb 72%, #bcd3ee) !important;
}

#deckBuilder {
  place-items: start center;
  overflow: auto;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.deckCard {
  width: min(560px, 100%);
  max-height: none;
  padding: 16px 12px;
  overflow: visible;
}

.deckCard h1 {
  margin-bottom: 4px;
}

.deckHint {
  min-height: 20px;
  margin: 2px 0 8px !important;
  font-size: 15px !important;
}


.cardGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 6px;
  justify-items: center;
}

.cardGrid button {
  position: relative;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

.cardGrid canvas {
  display: block;
  margin: 0 auto;
  filter: drop-shadow(2px 3px 0 rgba(86, 81, 73, 0.2));
}

.cardGrid button.picked canvas {
  outline: 3px dashed var(--juice);
  outline-offset: 2px;
}

.cardGrid button.owned::after {
  position: absolute;
  right: 2px;
  top: 36%;
  padding: 0 4px;
  border: 1.5px solid var(--marker);
  background: var(--sticky);
  color: var(--marker);
  content: "IN DECK";
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 8px;
  transform: rotate(-6deg);
}

.deckDetail {
  min-height: 62px;
  margin: 10px 0 6px;
  padding: 7px 10px;
  border: 2px dashed rgba(38, 35, 31, 0.45);
  background: #fffdf6;
  font-size: 14px;
  line-height: 1.2;
  text-align: left;
}

.deckDetail strong {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 16px;
}

.deckTabs {
  display: flex;
  gap: 6px;
  margin: 6px 0 10px;
}

.deckTabs button {
  min-height: 38px !important;
  margin: 0 !important;
  font-size: 14px !important;
  background: #fffaf0 !important;
}

.deckTabs button.active {
  background: linear-gradient(180deg, #fff3c9, var(--sticky) 72%, #efd98c) !important;
}

.deckButtons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.deckButtons button {
  margin: 0;
}

#pauseButton {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 34px;
  height: 30px;
  padding: 0;
  border: 2px solid var(--marker);
  border-radius: 5px 9px 6px 8px;
  background: #fffaf0;
  box-shadow: 2px 2px 0 rgba(86, 81, 73, 0.22);
  touch-action: manipulation;
}

#pauseButton svg {
  width: 20px;
  height: 20px;
}

#pauseButton path,
.speakerToggle path {
  fill: none;
  stroke: var(--marker);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.6;
}

.menuCard .speakerToggle {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 52px;
  min-height: 0;
  margin: 0;
  padding: 3px 2px 2px;
  border: 2px solid var(--marker);
  border-radius: 6px 10px 7px 9px;
  background: #fffaf0;
  box-shadow: 2px 2px 0 rgba(86, 81, 73, 0.2);
  font-size: 10px;
  line-height: 1;
  transform: rotate(2deg);
}

.speakerToggle svg {
  width: 30px;
  height: 26px;
}

.speakerToggle .waves {
  stroke: var(--pen-blue);
}

.speakerToggle .mute {
  stroke: var(--pen-red);
}

.speakerToggle[aria-pressed="false"] {
  opacity: 0.8;
}

.cardGrid button.swapping canvas {
  transform: translateY(-4px) rotate(-1.5deg);
}

/* SWAP from a collection card: the deck cards it can replace wiggle, the rest fade. */
.cardGrid button.swapTarget canvas {
  animation: swapTargetWiggle 0.9s ease-in-out infinite;
  filter: drop-shadow(0 0 3px rgba(238, 138, 42, 0.9));
}

.cardGrid button.noFit {
  opacity: 0.4;
}

@keyframes swapTargetWiggle {
  0%, 100% { transform: rotate(-1.5deg); }
  50% { transform: rotate(1.5deg) translateY(-2px); }
}

@media (prefers-reduced-motion: reduce) {
  .cardGrid button.swapTarget canvas {
    animation: none;
  }
}

.cardGrid .scribble {
  position: absolute;
  inset: -7px -6px;
  width: calc(100% + 12px);
  height: calc(100% + 14px);
  overflow: visible;
  pointer-events: none;
}

.cardGrid .scribble path {
  fill: none;
  stroke: var(--juice);
  stroke-linecap: round;
  stroke-width: 3.4;
  stroke-dasharray: 420;
  stroke-dashoffset: 420;
  vector-effect: non-scaling-stroke;
  animation: scribbleIn 280ms ease-out forwards;
}

.swapLabel {
  position: absolute;
  bottom: -8px;
  left: 50%;
  padding: 0 5px;
  border: 1.5px solid var(--marker);
  background: var(--sticky);
  color: var(--marker);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 9px;
  transform: translateX(-50%) rotate(-4deg);
  pointer-events: none;
}

@keyframes scribbleIn {
  to { stroke-dashoffset: 0; }
}

.cardGrid button.swooshIn canvas {
  animation: swooshCard 380ms ease-out;
}

.cardGrid .swoosh {
  position: absolute;
  top: 30%;
  left: -14%;
  width: 128%;
  height: 46%;
  overflow: visible;
  pointer-events: none;
  animation: swooshFade 520ms ease-out forwards;
}

.cardGrid .swoosh path {
  fill: none;
  stroke: var(--graphite);
  stroke-linecap: round;
  stroke-width: 3;
  stroke-dasharray: 140;
  stroke-dashoffset: 140;
  animation: swooshDraw 300ms ease-out forwards;
}

@keyframes swooshDraw {
  to { stroke-dashoffset: 0; }
}

@keyframes swooshFade {
  0%, 60% { opacity: 0.85; }
  100% { opacity: 0; }
}

@keyframes swooshCard {
  from { transform: translate(-18px, -10px) rotate(-9deg) scale(0.9); opacity: 0.3; }
  to { transform: none; opacity: 1; }
}

/* Menu row: deck and team side by side */
.menuRow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.teamMenuButton {
  background: linear-gradient(180deg, #fff0f6, #fbdbe9 72%, #efbdd4) !important;
}

/* Card detail stat bars */
#cardDetail .detailStats,
.deckDetail .statBars {
  display: block;
  margin: 4px 0 1px;
}

/* TEAM screen */
#teamScreen {
  place-items: start center;
  overflow: auto;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.teamCard {
  width: min(520px, 100%);
  min-width: 0;
  box-sizing: border-box;
  max-height: none;
  padding: 16px 14px;
  overflow: visible;
}

.teamCard h1 {
  margin-bottom: 6px;
}

.teamPreviewRow {
  display: flex;
  max-width: 100%;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 4px 0 6px;
}

.teamPreviewCard:first-child {
  transform: rotate(-4deg);
}

.teamPreviewCard:last-child {
  transform: rotate(4deg);
}

.kitBlock {
  margin: 8px 0 2px;
  padding: 6px 10px 8px;
  border: 2px dashed rgba(38, 35, 31, 0.4);
  border-radius: 6px 10px 5px 9px;
  background: #fffdf6;
  text-align: left;
}

.kitBlock h2 {
  margin: 0;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 16px;
  font-weight: 400;
}

.kitLabel {
  margin: 4px 0 2px;
  font-size: 15px;
}

.kitLabel span {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 13px;
}

.swatches {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
}

.menuCard .swatch {
  position: relative;
  width: 100%;
  min-height: 0;
  aspect-ratio: 1;
  max-width: 44px;
  margin: 0 auto;
  padding: 0;
  border: 2px solid var(--marker);
  border-radius: 48% 52% 45% 55% / 52% 46% 54% 48%;
  background: var(--pen);
  box-shadow: inset -3px -4px 0 rgba(0, 0, 0, 0.14);
}

.menuCard .swatch:nth-child(2n) {
  border-radius: 54% 46% 52% 48% / 46% 55% 45% 54%;
}

.swatchRing {
  position: absolute;
  inset: -7px;
  width: calc(100% + 14px);
  height: calc(100% + 14px);
  overflow: visible;
  pointer-events: none;
}

.swatchRing path {
  fill: none;
  stroke: var(--marker);
  stroke-width: 3.2;
  stroke-linecap: round;
}

/* After-play recap: a sticky note between the played-card chips */
#cardRecap {
  position: absolute;
  top: calc(116px + var(--safe-top));
  left: calc(64px + var(--safe-left));
  right: calc(64px + var(--safe-right));
  padding: 5px 9px 6px;
  border: 1px solid rgba(150, 120, 40, 0.35);
  background: linear-gradient(180deg, #fff6b8, #fbe98a);
  box-shadow: 2px 3px 0 rgba(86, 81, 73, 0.18);
  color: var(--marker);
  font-size: 12.5px;
  line-height: 1.15;
  transform: rotate(-0.8deg);
  /* BUILD 10: a tap puts it away. */
  pointer-events: auto;
  cursor: pointer;
  animation: recapIn 0.22s ease-out;
  transition: opacity 0.35s ease-in;
}

#cardRecap.fading {
  opacity: 0;
}

#cardRecap .recapLine {
  display: block;
}

#cardRecap .recapLine + .recapLine {
  margin-top: 2px;
}

#cardRecap strong {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 11.5px;
  font-weight: 400;
}

#cardRecap .nothing {
  opacity: 0.72;
}

@keyframes recapIn {
  from { transform: translateY(-6px) rotate(-3deg); opacity: 0; }
  to { transform: rotate(-0.8deg); opacity: 1; }
}

/* Menu header: name, trophies, coins */
.menuHeader {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 4px 12px;
  margin: 0 56px 6px;
  font-size: 15px;
}

.menuName {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 15px;
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menuStats {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 2px 10px;
}

.menuStats > span {
  white-space: nowrap;
}

.menuStats span:empty {
  display: none;
}

.menuCard .gearButton {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  width: 44px;
  min-height: 0;
  height: 44px;
  margin: 0;
  padding: 4px;
  border: 2px solid var(--marker);
  border-radius: 50% 46% 52% 48%;
  background: #fffdf6;
}

.gearButton svg {
  width: 100%;
  height: 100%;
}

.gearButton path,
.gearButton circle {
  fill: none;
  stroke: var(--marker);
  stroke-width: 2.4;
  stroke-linejoin: round;
}

/* Generic scrolling sheet used by settings, shop, friends and the rest */
.scrollOverlay {
  grid-template-columns: minmax(0, 1fr);
  place-items: start center;
  overflow: auto;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.sheetCard {
  width: min(520px, 100%);
  max-height: none;
  padding: 16px 14px;
  overflow: visible;
  text-align: left;
}

.sheetCard h1,
.sheetCard .menuKicker {
  text-align: center;
}

.fieldLabel {
  display: block;
  margin: 12px 0 4px;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 14px;
}

.fieldRow {
  display: flex;
  gap: 8px;
  align-items: center;
}

.fieldRow input,
.fieldRow code {
  flex: 1 1 auto;
  min-width: 0;
}

.menuCard .smallButton {
  flex: 0 0 auto;
  width: auto;
  min-height: 44px;
  margin: 0;
  padding: 4px 12px;
  font-size: 15px;
}

.fieldNote {
  min-height: 0;
  margin: 4px 0 0;
  font-size: 14px;
  opacity: 0.8;
}

.fieldNote:empty {
  display: none;
}

.saveCode {
  padding: 10px;
  border: 2px dashed rgba(38, 35, 31, 0.5);
  background: #fffdf6;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 15px;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
  user-select: all;
}

.idNote {
  margin-top: 12px;
  text-align: center;
}

/* Collection: copies toward the next level, locked cards, upgrade */
.cardGrid button {
  position: relative;
}

.copyBar {
  position: relative;
  display: block;
  height: 13px;
  margin: 2px 3px 0;
  border: 1.5px solid var(--marker);
  border-radius: 3px 5px 3px 4px;
  background: #fffdf6;
  overflow: hidden;
}

.copyBar .copyFill {
  position: absolute;
  inset: 0 auto 0 0;
  background: repeating-linear-gradient(-45deg, #7fb3e8 0 3px, #5b93d4 3px 5px);
}

.copyBar.ready .copyFill {
  width: 100% !important;
  background: repeating-linear-gradient(-45deg, #8ad08a 0 3px, #4fa65a 3px 5px);
}

.copyBar em {
  position: relative;
  display: block;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 9px;
  font-style: normal;
  line-height: 11px;
  text-align: center;
}

.copyBar.ready {
  animation: readyPulse 1.2s ease-in-out infinite;
}

.copyBar.max {
  background: #f3cf63;
}

.copyBar.big {
  height: 18px;
  margin: 6px 0 4px;
}

.copyBar.big em {
  font-size: 12px;
  line-height: 15px;
}

@keyframes readyPulse {
  50% { transform: scale(1.04); }
}

.cardGrid button.locked {
  opacity: 0.82;
}

.deckDetail {
  position: relative;
}

.upgradeRow {
  margin-top: 4px;
}

.menuCard .upgradeButton {
  width: 100%;
  min-height: 44px;
  margin: 2px 0;
  font-size: 15px;
  background: linear-gradient(180deg, #e9f8e4, #bfe6b5 72%, #94cf88);
}

.menuCard .upgradeButton:disabled {
  opacity: 0.5;
}

.upgradeNote {
  display: block;
  font-size: 13px;
  opacity: 0.8;
}

.levelScribble {
  position: absolute;
  inset: 10% 5% auto;
  width: 90%;
  height: 60%;
  pointer-events: none;
}

.levelScribble path {
  fill: none;
  stroke: #4fa65a;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 420;
  stroke-dashoffset: 420;
  animation: drawScribble 0.55s ease-out forwards, fadeOut 0.4s 1.4s forwards;
}

.levelStamp {
  position: absolute;
  top: 6px;
  right: 8px;
  padding: 2px 8px;
  border: 2.5px solid #2e7d4f;
  color: #2e7d4f;
  background: #fffdf6;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 18px;
  transform: rotate(-8deg);
  animation: stampIn 0.3s ease-out, fadeOut 0.4s 2s forwards;
  pointer-events: none;
}

@keyframes drawScribble {
  to { stroke-dashoffset: 0; }
}

@keyframes stampIn {
  from { transform: rotate(-8deg) scale(2); opacity: 0; }
}

@keyframes fadeOut {
  to { opacity: 0; }
}

/* Pack slots on the menu */
.packArea {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 2px dashed rgba(38, 35, 31, 0.3);
}

.packSlots {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.menuCard .packSlot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-height: 0;
  margin: 0;
  padding: 4px 2px 3px;
  border: 2px solid var(--marker);
  border-radius: 6px 9px 5px 8px;
  background: #fffdf6;
  font-family: "Paper Hand", cursive;
  font-size: 13px;
}

.menuCard .packSlot.empty {
  border-style: dashed;
  opacity: 0.6;
}

.packSlot canvas {
  max-width: 100%;
}

.packLabel {
  white-space: nowrap;
}

.menuCard .packSlot.ready {
  background: #fff6c8;
  animation: packBounce 1s ease-in-out infinite;
}

.menuCard .packSlot.ready .packLabel {
  font-family: "Marker Display", "Paper Hand", cursive;
  color: #2e7d4f;
}

.menuCard .packSlot.unlocking .packLabel {
  color: var(--pen-blue);
}

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

.menuCard .freePack {
  font-size: clamp(12px, 3.4vw, 17px);
  background: linear-gradient(180deg, #f6f1e4, #e6dcc4 72%, #d3c6a6);
}

.menuCard .freePack.ready {
  background: linear-gradient(180deg, #f1ffe9, #c8eebd 72%, #9fd890);
  animation: packBounce 1.2s ease-in-out infinite;
}

.menuCard .freePack:disabled {
  opacity: 1;
  color: rgba(38, 35, 31, 0.6);
}

.shopMenuButton {
  background: linear-gradient(180deg, #fff3e3, #fbd9ae 72%, #efbd7c) !important;
}

.packNote {
  min-height: 18px;
  margin: 2px 0 0;
  font-size: 14px;
  text-align: center;
}

/* Pack opening */
#packOpening {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 16px calc(20px + var(--safe-bottom));
  overflow: auto;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 246, 200, 0.95), rgba(236, 222, 190, 0.98) 70%),
    #efe3c6;
}

#packStage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 260px;
  justify-content: center;
}

#packHint {
  min-height: 22px;
  margin: 0;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 18px;
  text-align: center;
}

.bigPack {
  position: relative;
  width: 187px;
  height: 260px;
  animation: packIdle 1.8s ease-in-out infinite;
}

.bigPack canvas {
  position: absolute;
  top: 0;
  left: 0;
}

.bigPack .packBody,
.bigPack .packCrimp {
  z-index: 2;
}

/* The foil catches the light while it waits. Rookie packs are plain paper. */
.bigPack .packShine {
  position: absolute;
  inset: 8px 8px;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
  mix-blend-mode: soft-light;
}

.bigPack .packShine::before {
  content: "";
  position: absolute;
  top: -20%;
  bottom: -20%;
  width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85), transparent);
  transform: skewX(-18deg);
  animation: foilSweep 2.4s ease-in-out infinite;
}

.bigPack.pack-rookie .packShine {
  display: none;
}

.packStack {
  position: absolute;
  left: 18px;
  top: 34px;
  z-index: 1;
  width: 150px;
  height: 203px;
}

.packStack canvas {
  transform: translate(calc(var(--i) * 3px), calc(var(--i) * -2px)) rotate(calc((var(--i) - 1) * 2deg));
}

.bigPack.shaking {
  animation: packShake 0.1s linear infinite;
}

.bigPack.pack-elite.shaking,
.bigPack.pack-goat.shaking {
  animation: packShakeHard 0.08s linear infinite;
}

.bigPack.torn,
.bigPack.sliding {
  animation: none;
}

.bigPack.torn .packCrimp {
  animation: crimpTear 0.5s ease-in forwards;
}

.bigPack.torn .packShine {
  opacity: 0;
}

.bigPack.sliding .packStack {
  animation: stackSlide 0.75s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

.bigPack.sliding .packBody {
  animation: packDrop 0.7s 0.15s ease-in forwards;
}

@keyframes packIdle {
  50% { transform: rotate(-2deg) scale(1.02); }
}

@keyframes foilSweep {
  from { left: -50%; }
  60%, to { left: 120%; }
}

@keyframes packShake {
  25% { transform: translate(-3px, 1px) rotate(-2deg); }
  75% { transform: translate(3px, -1px) rotate(2deg); }
}

@keyframes packShakeHard {
  25% { transform: translate(-5px, 2px) rotate(-3.5deg) scale(1.03); }
  75% { transform: translate(5px, -2px) rotate(3.5deg) scale(1.03); }
}

@keyframes crimpTear {
  30% { transform: translate(14px, -10px) rotate(6deg); }
  to { transform: translate(170px, -120px) rotate(34deg); opacity: 0; }
}

@keyframes stackSlide {
  to { transform: translateY(-46px) scale(1.06); }
}

@keyframes packDrop {
  70% { opacity: 1; }
  to { transform: translateY(280px) rotate(-5deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .bigPack,
  .bigPack .packShine::before {
    animation: none;
  }
}

.flipCard {
  position: relative;
  width: 170px;
  height: 230px;
  perspective: 700px;
}

.flipCard canvas {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  transition: transform 0.45s ease-out;
}

.flipCard .flipFront {
  transform: rotateY(180deg);
}

.flipCard.flipped .flipBack {
  transform: rotateY(-180deg);
}

.flipCard.flipped .flipFront {
  transform: rotateY(0deg);
}

.flipCard.shaking {
  animation: cardShake 0.12s linear infinite;
}

.flipCard.shaking.rarity-elite,
.flipCard.shaking.rarity-goat {
  animation: cardShakeHard 0.09s linear infinite;
}

.flipCard.flipped.rarity-goat {
  filter: drop-shadow(0 0 14px rgba(240, 190, 40, 0.9));
}

@keyframes cardShake {
  25% { transform: translate(-2px, 1px) rotate(-1.5deg); }
  75% { transform: translate(2px, -1px) rotate(1.5deg); }
}

@keyframes cardShakeHard {
  25% { transform: translate(-4px, 2px) rotate(-3deg) scale(1.03); }
  75% { transform: translate(4px, -2px) rotate(3deg) scale(1.03); }
}

.flipCaption {
  margin: 10px 0 0;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 16px;
  text-align: center;
}

.newSticker {
  position: absolute;
  top: -10px;
  right: -14px;
  padding: 3px 9px;
  border: 2px solid #b8321f;
  border-radius: 40% 50% 45% 55%;
  background: #ffe34d;
  color: #b8321f;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 18px;
  transform: rotate(12deg);
  animation: stampIn 0.3s ease-out;
}

.newSticker.small {
  top: -6px;
  right: -6px;
  padding: 1px 5px;
  font-size: 12px;
}

.goatBurst {
  position: absolute;
  inset: -40px;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.goatBurst svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.goatBurst path {
  fill: none;
  stroke: #d9a933;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 90;
  stroke-dashoffset: 90;
  animation: drawScribble 0.5s ease-out forwards;
}

.goatBurst span {
  position: relative;
  margin-top: -250px;
  color: #c99a1e;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 46px;
  text-shadow: 2px 2px 0 #fff6c8;
  transform: rotate(-10deg);
  animation: stampIn 0.35s ease-out;
}

#packSummary {
  width: min(420px, 100%);
  text-align: center;
}

#packSummary h2 {
  margin: 0 0 8px;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-weight: 400;
  font-size: 24px;
}

.summaryGrid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.summaryCard {
  position: relative;
}

.summaryCoins {
  margin: 10px 0 0;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 20px;
  color: #c99a1e;
}

/* SKIP during an opening: straight to the haul. The tutorial's SKIP hides while a pack is open. */
.packSkip {
  position: absolute;
  top: calc(8px + var(--safe-top));
  right: calc(10px + var(--safe-right));
  z-index: 2;
  min-height: 36px;
  padding: 2px 14px;
  border: 1.5px dashed rgba(38, 35, 31, 0.55);
  border-radius: 6px;
  background: rgba(255, 250, 240, 0.92);
  color: var(--graphite);
  font-family: "Paper Hand", cursive;
  font-size: 16px;
  letter-spacing: 0.06em;
}

.packSkip[hidden],
#packStage[hidden],
#packHint[hidden] {
  display: none;
}

#app.packOpen .guideSkip {
  display: none;
}

/* The haul: fills the screen top to bottom. */
#packOpening.hauling {
  justify-content: space-between;
  gap: 4px;
  padding-top: calc(14px + var(--safe-top));
  overflow-x: hidden;
}

#packOpening.hauling #packSummary {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 0;
}

/* Pack name at the top; the fan and its coin pile together in the middle of what's left. */
.haulHead {
  text-align: center;
}

.haulFan {
  margin-top: auto;
}

.haulCoins {
  margin: 18px 0 auto;
}

#packSummary h2.haulTitle {
  margin: 0;
  font-size: clamp(30px, 9vw, 44px);
  line-height: 1;
  letter-spacing: 0.04em;
  transform: rotate(-2deg);
  animation: stampIn 0.3s ease-out;
}

.haulTitle.pack-rookie { color: #6f685d; }
.haulTitle.pack-pro { color: #2e7d4f; }
.haulTitle.pack-elite { color: #6a3fa0; }

.haulCount {
  margin: 4px 0 0;
  font-family: "Paper Hand", cursive;
  font-size: 17px;
  opacity: 0.75;
}

.summaryGrid.haulFan {
  position: relative;
  display: block;
  width: 100%;
  flex: 0 0 auto;
}

.haulCard {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) rotate(var(--r));
  transform-origin: 50% 50%;
  animation: haulIn 0.42s cubic-bezier(0.2, 1.3, 0.4, 1) both;
  animation-delay: calc(var(--i) * 60ms);
  cursor: pointer;
}

.haulCard canvas {
  display: block;
  filter: drop-shadow(3px 5px 0 rgba(86, 81, 73, 0.22));
}

@keyframes haulIn {
  from {
    opacity: 0;
    transform: translate(-50%, 10%) rotate(0deg) scale(0.6);
  }
}

/* The best card's rarity frame: a glow in its rarity color with marker rays behind it. */
.haulFrame {
  position: absolute;
  inset: -14px;
  z-index: -1;
  border-radius: 18px;
  background: radial-gradient(closest-side, var(--rarity-glow, rgba(255, 230, 140, 0.9)), transparent 100%);
  animation: haulGlow 1.8s ease-in-out infinite;
}

.haulFrame::before {
  position: absolute;
  inset: -26px;
  background: repeating-conic-gradient(from 0deg, var(--rarity-ray, rgba(240, 190, 40, 0.35)) 0deg 7deg, transparent 7deg 22deg);
  border-radius: 50%;
  -webkit-mask: radial-gradient(closest-side, #000 55%, transparent 100%);
  mask: radial-gradient(closest-side, #000 55%, transparent 100%);
  content: "";
}

/* The frame traces the painted card itself (the canvas has room above it for art that pops out). */
.haulCard.best canvas {
  filter: drop-shadow(0 0 1.5px var(--rarity-line, #b7871a)) drop-shadow(0 0 1.5px var(--rarity-line, #b7871a)) drop-shadow(0 0 1.5px var(--rarity-line, #b7871a)) drop-shadow(0 0 12px var(--rarity-glow, rgba(255, 230, 140, 0.9)));
}

.haulCard.rarity-rookie { --rarity-line: #8a8172; --rarity-glow: rgba(210, 200, 180, 0.8); --rarity-ray: rgba(138, 129, 114, 0.25); }
.haulCard.rarity-starter { --rarity-line: #2f5fb5; --rarity-glow: rgba(150, 190, 255, 0.75); --rarity-ray: rgba(47, 95, 181, 0.25); }
.haulCard.rarity-pro { --rarity-line: #2e7d4f; --rarity-glow: rgba(140, 220, 170, 0.8); --rarity-ray: rgba(46, 125, 79, 0.28); }
.haulCard.rarity-elite { --rarity-line: #6a3fa0; --rarity-glow: rgba(200, 160, 255, 0.85); --rarity-ray: rgba(106, 63, 160, 0.3); }
.haulCard.rarity-goat { --rarity-line: #c99a1e; --rarity-glow: rgba(255, 220, 110, 0.95); --rarity-ray: rgba(217, 169, 51, 0.45); }

@keyframes haulGlow {
  50% { opacity: 0.65; }
}

.haulRarity {
  position: absolute;
  bottom: -14px;
  left: 50%;
  padding: 1px 12px;
  border: 2px solid var(--marker);
  border-radius: 4px 8px 5px 9px;
  background: var(--rarity-line, #b7871a);
  color: #fffaf0;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 16px;
  letter-spacing: 0.08em;
  white-space: nowrap;
  transform: translateX(-50%) rotate(-3deg);
}

.levelBadge {
  position: absolute;
  bottom: 18%;
  left: -10px;
  padding: 3px 8px;
  border: 2px solid #1f5e38;
  border-radius: 45% 55% 50% 50%;
  background: #8fe0a8;
  color: #1f5e38;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 15px;
  white-space: nowrap;
  transform: rotate(-10deg);
  animation: stampIn 0.3s ease-out;
}

.levelBadge.small {
  left: -6px;
  padding: 1px 5px;
  font-size: 12px;
}

.haulCard.left .newSticker {
  right: auto;
  left: -6px;
  transform: rotate(-12deg);
}

.haulCard.right .levelBadge {
  left: auto;
  right: -6px;
  transform: rotate(10deg);
}

.haulCoins {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.haulCoins .coinPile {
  width: 72px;
  height: 48px;
}

.haulCoins .summaryCoins {
  margin: 0;
  font-size: 26px;
}

@media (prefers-reduced-motion: reduce) {
  .haulCard,
  .haulFrame,
  #packSummary h2.haulTitle {
    animation: none;
  }
}

#packDoneButton {
  width: min(320px, 100%);
  min-height: 52px;
  border: 2px solid var(--marker);
  border-radius: 4px 10px 6px 8px;
  background: linear-gradient(180deg, #fff3c9, var(--sticky) 72%, #efd98c);
  color: var(--marker);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 20px;
}

/* Shop */
.centerNote {
  text-align: center;
}

.shopOffers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.shopOffer {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.shopOffer canvas {
  max-width: 100%;
  height: auto !important;
}

.shopTag {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 12px;
}

.menuCard .buyButton {
  width: 100%;
  padding: 4px 2px;
  font-size: 13px;
}

.emptySwap {
  grid-column: 1 / -1;
  margin: 10px 4px;
  padding: 10px;
  border: 2px dashed rgba(38, 35, 31, 0.4);
  font-size: 15px;
  text-align: center;
}

.roadMenuButton {
  background: linear-gradient(180deg, #fff8dc, #f6dd8f 72%, #e4c160) !important;
}

/* Trophy road */
.roadList {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 10px;
  padding-left: 14px;
  border-left: 3px dashed rgba(38, 35, 31, 0.35);
}

.roadStep,
.roadLeague {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  padding: 6px 8px;
  border: 2px solid rgba(38, 35, 31, 0.35);
  border-radius: 5px 9px 6px 8px;
  background: #fffdf6;
}

.roadLeague {
  border-color: var(--marker);
  background: #f6efdc;
}

.roadLeague strong {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-weight: 400;
  font-size: 17px;
}

.roadLeague span:last-child {
  flex-basis: 100%;
  font-size: 13px;
}

.roadLeague.reached {
  background: #eaf4e2;
}

.paperSwatch {
  width: 26px;
  height: 26px;
  border: 2px solid var(--marker);
  border-radius: 4px;
  background-size: 64px;
}

.roadTrophies {
  min-width: 46px;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 15px;
}

.roadReward {
  flex: 1 1 120px;
  font-size: 15px;
}

.roadStep.claimed {
  opacity: 0.55;
}

.roadStep.claimable {
  border-color: #2e7d4f;
  background: #f1fbea;
}

.roadStep.next {
  border-style: dashed;
  border-color: var(--pen-blue);
}

.roadCheck {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 12px;
  color: #2e7d4f;
}

.roadLeft {
  font-size: 13px;
  opacity: 0.7;
}

.menuCard .claimButton {
  min-height: 38px;
  background: linear-gradient(180deg, #f1ffe9, #c8eebd 72%, #9fd890);
}

/* League up */
#leagueUp {
  z-index: 32;
}

.leagueCard {
  text-align: center;
}

.leaguePaper {
  width: 120px;
  height: 90px;
  margin: 6px auto 4px;
  border: 2px solid var(--marker);
  border-radius: 4px 8px 5px 7px;
  background-size: 128px;
  transform: rotate(-3deg);
  box-shadow: 3px 4px 0 rgba(38, 35, 31, 0.18);
}

#leagueUp.celebrate .leagueCard {
  animation: leaguePop 0.5s ease-out;
}

#leagueUp.celebrate .leaguePaper {
  animation: paperFlip 0.8s ease-out;
}

@keyframes leaguePop {
  from { transform: scale(0.6) rotate(-6deg); opacity: 0; }
}

@keyframes paperFlip {
  from { transform: rotateY(90deg) rotate(-3deg); }
}

/* Friends */
.friendsMenuButton {
  position: relative;
  background: linear-gradient(180deg, #eefaf7, #c9ece4 72%, #9fd6c9) !important;
}

.badge {
  position: absolute;
  top: -8px;
  right: -6px;
  min-width: 22px;
  padding: 1px 6px;
  border: 2px solid var(--marker);
  border-radius: 50%;
  background: #e5533d;
  color: #fff;
  font-size: 13px;
}

.badge[hidden] {
  display: none;
}

.friendGroup {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0;
}

.friendGroup:empty {
  display: none;
}

.friendRow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  padding: 6px 8px;
  border: 2px solid rgba(38, 35, 31, 0.35);
  border-radius: 5px 9px 6px 8px;
  background: #fffdf6;
}

.friendRow.request {
  border-color: #2e7d4f;
  background: #f1fbea;
}

.friendRow.linkCard {
  border-color: var(--pen-blue);
  margin-bottom: 6px;
}

.friendName {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.onlineDot {
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--marker);
  border-radius: 50%;
  background: #cfc6b2;
  flex: 0 0 auto;
}

.onlineDot.on {
  background: #4fc25f;
}

.friendSwatch {
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--marker);
  border-radius: 3px;
  flex: 0 0 auto;
}

.friendMeta {
  flex: 1 1 auto;
  font-size: 13px;
  opacity: 0.75;
}

.friendCard {
  flex-direction: column;
  align-items: stretch;
}

.friendTop {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

.friendRecord {
  font-size: 14px;
}

.menuCard .challengeButton {
  width: 100%;
  background: linear-gradient(180deg, #fff3e3, #fbd9ae 72%, #efbd7c);
}

.menuCard .ghost {
  background: #fffdf6;
}

.menuCard .friendShare {
  min-height: 44px;
  font-size: 15px;
  background: linear-gradient(180deg, #eefaf7, #c9ece4 72%, #9fd6c9);
}

#friendSearch {
  width: 100%;
  min-height: 44px;
}

.inviteBanner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 8px;
  margin: 40px 0 8px;
  padding: 8px;
  border: 2px solid #2e7d4f;
  border-radius: 6px 10px 5px 9px;
  background: #f1fbea;
  font-size: 15px;
  animation: stampIn 0.3s ease-out;
}

.inviteBanner span {
  flex-basis: 100%;
  text-align: center;
}

.resultRecord {
  margin: 4px 0 0;
  font-size: 15px;
}

.resultRecord:empty {
  display: none;
}

/* Tap the opponent's name for their profile. */
.resultRecord .tapName {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

/* Emotes */
#emoteButton {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 34px;
  height: 30px;
  margin-right: 4px;
  padding: 1px;
  border: 2px solid var(--marker);
  border-radius: 9px 5px 8px 6px;
  background: #fff6c8;
  box-shadow: 2px 2px 0 rgba(86, 81, 73, 0.22);
  touch-action: manipulation;
  pointer-events: auto;
}

#emoteButton.cooling {
  opacity: 0.45;
}

#emoteButton svg {
  width: 24px;
  height: 24px;
}

.emoteArt path {
  fill: none;
  stroke: var(--marker);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.emoteArt .face {
  fill: #fff6c8;
}

.emoteArt .fill {
  fill: #8f3a2a;
}

.emoteArt .skin {
  fill: #f2c9a0;
}

.emoteArt .tear {
  stroke: #4a8fd8;
}

.emoteArt .steam {
  stroke: #d0642a;
}

.emote-angry .face {
  fill: #ffd2c4;
}

#emotePicker {
  position: absolute;
  right: calc(10px + var(--safe-right));
  bottom: calc(var(--tray-h) + 8px);
  z-index: 6;
  padding: 8px;
  border: 2px solid var(--marker);
  border-radius: 8px 12px 7px 10px;
  background: #fffdf6;
  box-shadow: 3px 4px 0 rgba(38, 35, 31, 0.2);
  pointer-events: auto;
}

.emoteChoices {
  display: grid;
  grid-template-columns: repeat(4, 56px);
  gap: 6px;
}

.emoteChoice {
  width: 56px;
  height: 56px;
  padding: 4px;
  border: 2px solid rgba(38, 35, 31, 0.4);
  border-radius: 50% 46% 52% 48%;
  background: #fffaf0;
}

.emoteChoice svg {
  width: 100%;
  height: 100%;
}

#emoteMute {
  width: 100%;
  margin-top: 6px;
  padding: 6px;
  border: 1.5px dashed rgba(38, 35, 31, 0.5);
  background: transparent;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 12px;
}

.emoteBubble {
  position: absolute;
  z-index: 5;
  width: 74px;
  height: 74px;
  padding: 8px;
  border: 2.5px solid var(--marker);
  border-radius: 50% 46% 52% 48%;
  background: #fffdf6;
  box-shadow: 3px 4px 0 rgba(38, 35, 31, 0.2);
  pointer-events: none;
}

.emoteBubble svg {
  width: 100%;
  height: 100%;
}

.emoteBubble.mine {
  left: calc(14px + var(--safe-left));
  bottom: calc(var(--tray-h) + 70px);
}

.emoteBubble.theirs {
  right: calc(14px + var(--safe-right));
  top: calc(170px + var(--safe-top));
}

.emoteBubble::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2.5px solid var(--marker);
  border-radius: 50%;
  background: #fffdf6;
}

.emoteBubble.mine::after {
  bottom: -16px;
  left: 10px;
}

.emoteBubble.theirs::after {
  top: -16px;
  right: 10px;
}

.emoteBubble.pop {
  animation: emotePop 0.35s ease-out, emoteFloat 2.4s ease-in-out;
}

@keyframes emotePop {
  from { transform: scale(0.3) rotate(-12deg); }
  70% { transform: scale(1.12) rotate(4deg); }
}

@keyframes emoteFloat {
  80% { opacity: 1; }
  to { opacity: 0; transform: translateY(-10px); }
}

/* CPU difficulty picker */
.cpuChoices {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menuCard .cpuChoice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 64px;
}

.cpuChoice small {
  font-family: "Paper Hand", cursive;
  font-size: 14px;
  line-height: 1.1;
}

.menuCard .cpuChoice.last {
  outline: 3px dashed var(--pen-blue);
  outline-offset: 2px;
}

.menuCard .cpuChoice[data-difficulty="easy"] {
  background: linear-gradient(180deg, #f1ffe9, #c8eebd 72%, #9fd890);
}

.menuCard .cpuChoice[data-difficulty="hard"] {
  background: linear-gradient(180deg, #fff0ea, #f6c3b2 72%, #e99a80);
}

/* Tournament */
.tourneyMenuButton {
  background: linear-gradient(180deg, #f3eefe, #d8cbf6 72%, #b9a4ea) !important;
}

.tourneyStatus {
  margin: 4px 0;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 17px;
  text-align: center;
}

.menuCard .playMatchButton {
  background: linear-gradient(180deg, #f1ffe9, #c8eebd 72%, #9fd890);
  animation: packBounce 1.2s ease-in-out infinite;
}

.menuCard .tourneyLink {
  width: 100%;
  margin: 4px 0;
}

.bracketPaper {
  margin: 8px 0;
  padding: 8px 6px 6px 18px;
  border: 2px solid rgba(38, 35, 31, 0.4);
  border-radius: 4px 8px 5px 7px;
  background:
    linear-gradient(90deg, transparent 12px, rgba(200, 70, 60, 0.3) 12px, rgba(200, 70, 60, 0.3) 13.5px, transparent 13.5px),
    repeating-linear-gradient(180deg, transparent 0 21px, rgba(84, 120, 190, 0.18) 21px 22px),
    #fffdf6;
  overflow-x: auto;
}

.bracketSvg {
  display: block;
  max-width: 100%;
  height: auto;
}

.bracketSvg path {
  fill: none;
  stroke: var(--marker);
  stroke-width: 1.6;
  stroke-linecap: round;
}

.bracketSvg .live path {
  stroke: var(--pen-blue);
  stroke-width: 2.2;
}

.bracketSvg text {
  font-family: "Paper Hand", cursive;
  font-size: 13px;
  fill: var(--marker);
}

.bracketSvg text.won {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 12px;
  fill: #2e7d4f;
}

.bracketSvg text.lost {
  opacity: 0.45;
  text-decoration: line-through;
}

.bracketSvg text.champ {
  fill: #c99a1e;
}

.bracketSvg .winLine {
  stroke: #2e7d4f;
  stroke-width: 1.4;
}

.trophyDoodle path {
  stroke: #9b8c6a;
  stroke-width: 2;
}

.trophyDoodle.won path {
  fill: #f3cf63;
  stroke: #8a6a12;
}

/* Profile */
.profileMenuButton {
  background: linear-gradient(180deg, #fdf3ea, #f3d8c2 72%, #e6b896) !important;
}

.profileHead {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profileSprite {
  flex: 0 0 auto;
}

.profileWho {
  min-width: 0;
}

.profileName {
  margin: 0;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-weight: 400;
  font-size: 22px;
  overflow-wrap: anywhere;
}

.profileLeague,
.profileTrophies,
.profileColors {
  margin: 2px 0 0;
  font-size: 15px;
}

.profileColors {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 13px;
}

.profileStats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 10px 0 4px;
}

.profileStat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 2px;
  border: 2px solid rgba(38, 35, 31, 0.35);
  border-radius: 5px 9px 6px 8px;
  background: #fffdf6;
}

.profileStat strong {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-weight: 400;
  font-size: 20px;
}

.profileStat span {
  font-size: 11px;
  letter-spacing: 0.05em;
}

.profileRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.trophyShelf {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding-bottom: 4px;
  border-bottom: 3px solid #b8925a;
}

.profileTrophy {
  width: 30px;
  height: 34px;
}

.profileTrophy path {
  fill: #f3cf63;
  stroke: #8a6a12;
  stroke-width: 2.2;
  stroke-linejoin: round;
}

.historyList {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.historyRow {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 6px 8px;
  border: 2px solid rgba(38, 35, 31, 0.3);
  border-radius: 5px 9px 6px 8px;
  background: #fffdf6;
}

.historyResult {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2.5px solid currentColor;
  border-radius: 50% 46% 52% 48%;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 16px;
  transform: rotate(-6deg);
}

.historyRow.win .historyResult {
  color: #2e7d4f;
}

.historyRow.loss .historyResult {
  color: #b8321f;
}

.historyRow.draw .historyResult {
  color: #6f685d;
}

.historyMain {
  flex: 1 1 auto;
  min-width: 0;
}

.historyTop {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 8px;
  font-size: 15px;
}

.historyTop strong {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-weight: 400;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.historyMeta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  font-size: 12px;
  opacity: 0.8;
}

.historyTrophies.up {
  color: #2e7d4f;
}

.historyTrophies.down {
  color: #b8321f;
}

.historyCards {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 3px;
}

.historyCard {
  padding: 0 6px;
  border: 1.5px solid rgba(38, 35, 31, 0.35);
  border-radius: 3px 6px 4px 5px;
  font-size: 12px;
}

.historyCard.offense {
  background: #dce9fb;
}

.historyCard.defense {
  background: #fadcd4;
}

.historyCard.none {
  opacity: 0.6;
}

/* Push: the sticky note ask, and the settings section */
#pushNote[hidden],
#pushNoteHint[hidden],
#pushNoteYes[hidden],
#pushToggle[hidden],
#pushTestButton[hidden] {
  display: none;
}

.pushNote {
  position: absolute;
  left: 50%;
  top: calc(16px + var(--safe-top));
  z-index: 40;
  width: min(300px, calc(100% - 40px));
  padding: 22px 16px 14px;
  border: 2px solid var(--marker);
  border-radius: 3px 3px 10px 4px;
  background: linear-gradient(180deg, #fff3c9, var(--sticky) 72%, #efd98c);
  box-shadow: 4px 6px 0 rgba(38, 35, 31, 0.22);
  color: var(--marker);
  text-align: center;
  transform: translateX(-50%) rotate(-1.5deg);
  pointer-events: auto;
}

.pushNote::before {
  content: "";
  position: absolute;
  top: -11px;
  left: 50%;
  width: 84px;
  height: 22px;
  background: var(--tape);
  transform: translateX(-50%) rotate(2deg);
}

.pushNote.pop {
  animation: pushNoteIn 0.35s ease-out;
}

@keyframes pushNoteIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-24px) rotate(4deg); }
  to { opacity: 1; transform: translateX(-50%) rotate(-1.5deg); }
}

.pushNoteText {
  margin: 0 0 6px;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 21px;
  line-height: 1.15;
}

.pushNoteHint {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.25;
}

.pushNoteButtons {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.pushNoteButtons button {
  min-width: 96px;
  min-height: 44px;
  padding: 4px 14px;
  border: 2px solid var(--marker);
  border-radius: 4px 10px 6px 8px;
  background: #fffdf6;
  color: var(--marker);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 18px;
}

#pushNoteYes {
  background: linear-gradient(180deg, #eefaf7, #c9ece4 72%, #9fd6c9);
}

.motionRow .fieldNote,
.pushRow .pushState {
  flex: 1 1 auto;
  margin: 0;
}

.pushTypes {
  display: grid;
  gap: 2px;
  margin-top: 6px;
}

.pushTypes:empty {
  display: none;
}

.menuCard .pushType {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  font-size: 16px;
}

.menuCard .pushType input {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: #2e7d4f;
}

.menuCard .pushTest {
  width: 100%;
  margin-top: 8px;
}

.inviteBanner.noteOnly button {
  display: none;
}

/* Roster v2: flavor quotes and either side cards */
.cardQuote {
  margin: 2px 0 4px;
  font-style: italic;
  font-size: 0.86em;
  opacity: 0.72;
}

.historyCard.either {
  background: rgba(236, 230, 210, 0.9);
  color: var(--ink, #2b2823);
}

/* Momentum: a little stamp that pops above the juice bar */
#juiceBar {
  position: relative;
}

#momentumPop {
  position: absolute;
  left: 50%;
  bottom: 22px;
  padding: 1px 7px;
  border: 2px solid #c0392b;
  border-radius: 4px 7px 5px 6px;
  background: #fff4c4;
  color: #c0392b;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 6px) rotate(-3deg);
}

#momentumPop.show {
  animation: momentumPop 1.6s ease-out forwards;
}

@keyframes momentumPop {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(0.6) rotate(-3deg); }
  14% { opacity: 1; transform: translate(-50%, -2px) scale(1.15) rotate(-3deg); }
  26% { transform: translate(-50%, 0) scale(1) rotate(-3deg); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -16px) scale(1) rotate(-3deg); }
}

/* Tournament names */
.tourneyName {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 8px 0;
  padding: 8px 10px;
  border: 2px solid var(--marker);
  border-radius: 4px 8px 5px 7px;
  background: #fffaf0;
  font: inherit;
}

.tourneyTitle {
  margin: 4px 0 0;
  text-align: center;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 22px;
}

/* Settings: legal links and DELETE MY ACCOUNT */
.legalLinks {
  margin: 10px 0 6px;
  text-align: center;
}

.legalLinks a {
  color: var(--marker);
  font-family: "Marker Display", "Paper Hand", cursive;
}

/* Need help? support email, in settings, on purchase results and on error notes. */
.supportLine {
  margin: 10px 0 4px;
  text-align: center;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.supportLine a {
  color: var(--marker);
  text-decoration: underline;
}

.dangerButton {
  border-color: #c0392b !important;
  color: #c0392b !important;
  background: #fff3ef !important;
}

#deleteAccountButton {
  display: block;
  margin: 6px auto;
}

.deleteBox {
  margin: 6px 0;
  padding: 8px 10px;
  border: 2px dashed #c0392b;
  border-radius: 4px 8px 5px 7px;
  background: #fffaf0;
}

.deleteBox .fieldRow {
  flex-wrap: wrap;
}

.deleteBox input {
  flex: 1 1 100%;
  min-width: 0;
}

/* Online connection dot: green, yellow or red from the measured round trip. */
#netDot {
  position: absolute;
  top: calc(6px + var(--safe-top));
  left: 50%;
  z-index: 9;
  width: 11px;
  height: 11px;
  margin-left: -5.5px;
  border: 2px solid var(--marker);
  border-radius: 50%;
  background: #9a948a;
  box-shadow: 0 0 0 2px rgba(255, 250, 240, 0.9);
  pointer-events: none;
}

#netDot[data-quality="good"] {
  background: #2e9e57;
}

#netDot[data-quality="okay"] {
  background: #e3b322;
}

#netDot[data-quality="bad"] {
  background: #c0392b;
  animation: netBlink 1.2s ease-in-out infinite;
}

@keyframes netBlink {
  50% { opacity: 0.45; }
}

/* A card on its way to the server (slow connection): shown as played, not tappable again. */
.handCard.sending {
  opacity: 0.55;
  transform: translateY(-6px);
}

/* ---------- Ink, the premium currency ---------- */
.inkStat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: #2a3a8c;
}

.inkBottle {
  width: 15px;
  height: 18px;
  flex: none;
  overflow: visible;
}

.inkBottle path {
  stroke: var(--ink, #1f2235);
  stroke-width: 1.3;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.inkBottle .inkCork {
  fill: #c89a62;
}

.inkBottle .inkGlass {
  fill: rgba(232, 240, 250, 0.9);
}

.inkBottle .inkFill {
  fill: #2a3a8c;
  stroke: none;
}

.inkBottle .inkShine {
  fill: none;
  stroke: #ffffff;
  stroke-width: 1.1;
}

/* ---------- Shop: test stamp, ink bundles, purchase screen ---------- */
.testStamp {
  position: absolute;
  top: 14px;
  right: 12px;
  z-index: 2;
  padding: 3px 8px;
  border: 3px solid #c0392b;
  border-radius: 6px;
  color: #c0392b;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 17px;
  letter-spacing: 0.06em;
  transform: rotate(8deg);
  opacity: 0.85;
  pointer-events: none;
  background: rgba(255, 250, 240, 0.6);
}

.shopSection {
  margin: 16px 0 6px;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 19px;
  font-weight: 400;
  text-align: left;
}

.inkBundles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.inkBundle {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 86px;
  margin: 0;
  padding: 8px 6px;
}

.inkBundle .inkBottle {
  width: 24px;
  height: 28px;
}

.inkBundle strong {
  font-size: 17px;
  font-weight: 400;
  color: #2a3a8c;
}

.inkBundle span {
  font-size: 15px;
}

.inkBundle em {
  position: absolute;
  top: -7px;
  right: -4px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #f2c230;
  color: #2b2823;
  font-style: normal;
  font-size: 11px;
  transform: rotate(4deg);
}

/* Every overlay respects the hidden attribute (some set display, which would beat it). */
.menuOverlay[hidden] {
  display: none !important;
}

/* ---------- Shop screen ---------- */
.shopCard .testStamp {
  position: relative;
  top: auto;
  right: auto;
  display: block;
  width: fit-content;
  margin: 2px auto 8px;
  padding: 4px 16px;
  font-size: 30px;
  border-width: 4px;
  transform: rotate(-4deg);
  box-shadow: inset 0 0 0 2px rgba(192, 57, 43, 0.25);
}

/* display: block above beat the hidden attribute, so the stamp showed to every player. */
.shopCard .testStamp[hidden] {
  display: none;
}

.shopWallet {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin: -2px 0 8px;
  font-size: 18px;
}

.shopWallet > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.coinDoodle {
  width: 18px;
  height: 18px;
  flex: none;
}

.coinDoodle ellipse {
  fill: #f2c230;
  stroke: var(--ink);
  stroke-width: 1.4;
}

.coinDoodle path {
  fill: none;
  stroke: #9a6f12;
  stroke-width: 1.3;
  stroke-linecap: round;
}

.shopTabs {
  position: sticky;
  max-width: calc(100% + 12px);
  top: 0;
  z-index: 3;
  display: flex;
  gap: 4px;
  margin: 0 -6px 4px;
  padding: 6px;
  overflow-x: auto;
  background: #fffaf0;
  border-bottom: 1.5px dashed rgba(43, 40, 35, 0.25);
  scrollbar-width: none;
}

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

.shopTabs button {
  flex: 1 0 auto;
  width: auto;
  min-height: 34px;
  margin: 0;
  padding: 4px 6px;
  font-size: 13px;
}

.shopBlock {
  scroll-margin-top: 52px;
}

.shopBlock .fieldNote {
  margin: 0 0 8px;
}

/* LAYOUT AND PACKS: four packs, two by two. */
.shopPackList {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.shopPack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

.shopPack strong {
  font-weight: 400;
  font-size: 16px;
}

.packDetail {
  font-size: 13px;
  opacity: 0.75;
}

.packArt {
  position: relative;
  min-height: 0;
  margin: 0;
  padding: 2px;
  background: none;
  border: none;
  box-shadow: none;
}

.packArt canvas {
  display: block;
  margin: 0 auto;
}

.oddsLink {
  position: absolute;
  right: -2px;
  bottom: -2px;
  padding: 0 4px;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  background: #fffaf0;
  font-size: 11px;
}

.shopPack .smallButton {
  width: 100%;
  min-height: 34px;
  margin-top: 4px;
  padding: 4px 2px;
  font-size: 13px;
  line-height: 1.1;
}

.inkButton {
  color: #2a3a8c;
}

.smallButton.armed,
button.armed {
  background: #2a3a8c;
  color: #fffaf0;
}

.coinBundles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.coinBundle {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.coinBundle .coinDoodle {
  width: 30px;
  height: 30px;
}

.coinBundle strong {
  font-weight: 400;
  font-size: 18px;
}

.coinBundle > span {
  font-size: 13px;
  opacity: 0.75;
}

.coinBundle .smallButton {
  width: 100%;
  margin-top: 4px;
  min-height: 34px;
  padding: 4px 2px;
  font-size: 13px;
}

.shopToast {
  position: sticky;
  bottom: 8px;
  z-index: 4;
  min-height: 0;
  margin: 10px 0 0;
  padding: 0;
  border-radius: 10px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.shopToast.show {
  padding: 8px 10px;
  border: 2px solid var(--ink);
  background: #fff6c8;
  opacity: 1;
}

#shopScreen.leaving {
  pointer-events: none;
}

.oddsPack {
  display: block;
  margin: 4px auto 6px;
}

.oddsTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

.oddsTable th {
  font-weight: 400;
  font-size: 13px;
  opacity: 0.7;
  text-align: right;
  padding: 2px 4px;
}

.oddsTable th:first-child,
.oddsTable td:first-child {
  text-align: left;
}

.oddsTable td {
  padding: 4px;
  text-align: right;
  border-top: 1.5px dashed rgba(43, 40, 35, 0.2);
}

.oddsTable .rarity-starter td:first-child { color: #2f5fb5; }
.oddsTable .rarity-pro td:first-child { color: #2e7d4f; }
.oddsTable .rarity-elite td:first-child { color: #6a3fa0; }
.oddsTable .rarity-goat td:first-child { color: #b8860b; }

.oddsNotes {
  font-size: 14px;
  text-align: left;
}

/* The odds sheet only ever scrolls up and down: the tape corner (.menuCard::after) sticks out past the right
   edge, which used to make the card a sideways scroller that slid off screen on iPhones. */
#oddsSheet {
  /* Over the sheet it was opened from (the pack sheet comes after it in the page). */
  z-index: 11;
  overflow: hidden;
  touch-action: none;
}

#oddsSheet .menuCard {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

/* The scroller clips the tape anyway: tuck it inside so there's nothing to the right to scroll to. */
#oddsSheet .menuCard::after {
  right: 6px;
}

#oddsSheet .oddsNotes {
  max-width: 100%;
  overflow-wrap: break-word;
}

@media (max-width: 360px) {
  .shopTabs button {
    padding: 4px 4px;
    font-size: 12px;
  }
}

/* ---------- Shop and pass emotes ---------- */
.emoteArt .dark { fill: #1f2235; }
.emoteArt .glint { stroke: #ffffff; stroke-width: 2.2; }
.emoteArt .boom { stroke: #e0662a; }
.emote-mindblown .face { fill: #fff0b8; }
.emoteArt .zz { stroke: #4a6fd8; stroke-width: 2.6; }
.emoteArt .heart { fill: #e0465a; }
.emoteArt .paper { fill: #fffdf4; stroke-width: 2.4; }
.emoteArt .letter { stroke: #2f5fb5; stroke-width: 4.2; }
.emoteArt .bag { fill: #c9a25e; }
.emoteArt .cash { stroke: #2e7d4f; stroke-width: 3.4; }

/* ---------- Locker and cosmetics ---------- */
.menuRow.menuRowThree {
  grid-template-columns: 1fr 1fr 1fr;
}

.menuRowThree > button {
  padding-left: 2px;
  padding-right: 2px;
  white-space: nowrap;
}

@media (max-width: 360px) {
  .menuRowThree > button {
    font-size: 15px;
  }
}

.lockerMenuButton {
  background: linear-gradient(180deg, #f3fbef, #dcefd2 72%, #bddcab) !important;
}

.lockerPreview {
  display: block;
  width: 220px;
  height: 120px;
  margin: 2px auto 4px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  transform: rotate(-0.6deg);
}

.lockerTabs button.active,
.shopTabs button.active {
  background: #2a3a8c;
  color: #fffaf0;
}

.cosmeticGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.cosmeticCell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 0;
  margin: 0;
  padding: 6px 4px;
  border: 2px solid rgba(43, 40, 35, 0.45);
  border-radius: 10px;
  background: #fffdf6;
  text-align: center;
  box-shadow: none;
}

.cosmeticCell strong {
  font-weight: 400;
  font-size: 14px;
  line-height: 1.1;
}

.cosmeticStatus {
  font-size: 12px;
  opacity: 0.75;
}

.cosmeticCell.on {
  border-color: #2a3a8c;
  box-shadow: inset 0 0 0 2px rgba(42, 58, 140, 0.25);
}

.cosmeticCell.on .cosmeticStatus {
  color: #2a3a8c;
  opacity: 1;
}

.cosmeticCell.locked .cosmeticThumb {
  opacity: 0.85;
}

.cosmeticCell.trying {
  border-style: dashed;
  border-color: #c0392b;
}

.cosmeticThumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
}

.emoteThumb .emoteArt {
  width: 56px;
  height: 56px;
}

.shopCosmetic .smallButton {
  width: 100%;
  min-height: 32px;
  margin-top: 2px;
  padding: 3px 2px;
  font-size: 13px;
}

.cosmeticGroup h3 {
  margin: 10px 0 0;
  font-weight: 400;
  font-size: 16px;
}

.lockerAction {
  text-align: center;
}

.lockerAction .smallButton {
  margin: 0 auto;
}

/* ---------- Playbook Pass ---------- */
.passMenuButton {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  background: linear-gradient(180deg, #fbf4ff, #eadbfa 72%, #d3bdf0) !important;
}

.passTier {
  font-size: 14px;
  white-space: nowrap;
}

.passMini {
  --progress: 0%;
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 5px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, #3d3a46 var(--progress), rgba(61, 58, 70, 0.15) var(--progress));
}

.passBar {
  display: block;
  margin: 4px auto 0;
}

.passXp {
  margin: 0;
  text-align: center;
  font-size: 15px;
}

.passPremium {
  margin: 6px 0 4px;
}

.passPremium .menuRow button {
  margin: 0;
  font-size: 15px;
}

.passPremiumOn {
  margin: 4px 0;
  padding: 6px;
  border: 2px dashed #6a3fa0;
  border-radius: 8px;
  color: #6a3fa0;
  text-align: center;
  font-size: 15px;
}

.passHeads,
.passRow {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
  align-items: stretch;
}

.passHeads {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 4px 0;
  background: #fffaf0;
  font-size: 13px;
  text-align: center;
  border-bottom: 1.5px dashed rgba(43, 40, 35, 0.25);
}

.passHeads span:last-child {
  color: #6a3fa0;
}

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

.passTierNumber {
  display: grid;
  place-items: center;
  align-self: center;
  width: 28px;
  height: 28px;
  border: 2px solid rgba(43, 40, 35, 0.4);
  border-radius: 50%;
  font-size: 14px;
  background: #fffdf6;
}

.passRow.reached .passTierNumber {
  border-color: #3d3a46;
  background: #3d3a46;
  color: #fffaf0;
}

.passRow.next .passTierNumber {
  border-style: dashed;
  border-color: #3d3a46;
}

.passCell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 86px;
  padding: 5px 4px;
  border: 2px solid rgba(43, 40, 35, 0.35);
  border-radius: 10px;
  background: #fffdf6;
  text-align: center;
}

.passCell.premium {
  background: #faf5ff;
  border-color: rgba(106, 63, 160, 0.45);
}

.passCell.locked {
  opacity: 0.72;
}

.passCell.claimed {
  opacity: 0.55;
}

.rewardArt {
  display: grid;
  place-items: center;
  min-height: 34px;
}

.rewardArt .inkBottle,
.rewardArt .coinDoodle {
  width: 26px;
  height: 28px;
}

.rewardArt canvas {
  display: block;
}

.rewardArt.exclusive .cosmeticThumb {
  width: 44px;
  height: 44px;
}

.passRewardLabel {
  font-size: 13px;
  line-height: 1.1;
}

.passClaimed,
.passLock {
  font-size: 11px;
  opacity: 0.8;
}

.passLock {
  color: #6a3fa0;
}

.passCell .claimButton {
  min-height: 28px;
  margin: 2px 0 0;
  padding: 2px 10px;
  font-size: 13px;
  width: auto;
}

.rewardArt .emoteThumb,
.rewardArt .emoteThumb .emoteArt {
  width: 40px;
  height: 40px;
}

/* ---------- Starter offer ---------- */
.starterCard .testStamp {
  top: -14px;
  right: -8px;
  font-size: 14px;
  background: #fffaf0;
  opacity: 1;
}

.starterItems {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0;
}

.starterItem {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-height: 84px;
  padding: 8px 4px;
  border: 2px dashed rgba(43, 40, 35, 0.4);
  border-radius: 10px;
  background: #fffdf6;
  font-size: 14px;
  text-align: center;
  line-height: 1.1;
}

.starterItem .inkBottle {
  width: 30px;
  height: 34px;
}

.starterItem .emoteArt {
  width: 40px;
  height: 40px;
}

.starterShopCard {
  margin: 6px 0 10px;
  padding: 6px 10px 10px;
  border: 3px solid #e0a020;
  border-radius: 12px;
  background: #fff6d8;
}

.starterShopCard .shopSection {
  margin-top: 4px;
}

.starterTag {
  padding: 1px 6px;
  border-radius: 4px;
  background: #c0392b;
  color: #fffaf0;
  font-size: 12px;
  vertical-align: middle;
}

/* ---- Captains Mode ---- */
.captainsMenuButton {
  background: linear-gradient(180deg, #eef6ff, #d6e7fb 72%, #b9d2f1) !important;
}

.captainsRewards {
  font-size: 12px !important;
}

#captainsPicker[hidden],
#draftScreen[hidden],
#draftPreview[hidden],
#resultUnlock[hidden] {
  display: none !important;
}

.draftScreen {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 6px;
  padding: calc(12px + var(--safe-top)) calc(16px + var(--safe-right)) calc(12px + var(--safe-bottom)) calc(16px + var(--safe-left));
  background:
    repeating-linear-gradient(180deg, transparent 0 27px, rgba(47, 95, 181, 0.12) 27px 28px),
    var(--paper-light);
  overflow: hidden;
  touch-action: manipulation;
}

.draftTop,
.draftBottom {
  display: grid;
  gap: 4px;
  justify-items: center;
}

.draftWho {
  display: flex;
  width: 100%;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.draftWho small {
  color: var(--graphite);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.draftName {
  overflow: hidden;
  color: var(--pen-red);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.draftPicks {
  display: flex;
  gap: 4px;
  justify-content: center;
  max-width: 100%;
}

.draftSlot {
  position: relative;
  border: 1.5px dashed rgba(86, 81, 73, 0.4);
  border-radius: 3px 5px 4px 6px;
}

.draftSlot.filled {
  border-color: transparent;
}

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

.draftSlot.landed {
  animation: draftLand 260ms ease-out;
}

@keyframes draftLand {
  0% { transform: scale(1.18) rotate(-4deg); }
  100% { transform: none; }
}

.draftMiddle {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  min-height: 0;
}

.draftRound {
  margin: 0;
  color: var(--pen-blue);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 15px;
  letter-spacing: 0.06em;
}

.draftFlip {
  display: flex;
  gap: 10px;
  justify-content: center;
  min-height: 120px;
}

.draftCard {
  position: relative;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  animation: draftFlipIn 360ms ease-out both;
  transition: transform 120ms ease, opacity 160ms ease;
  -webkit-tap-highlight-color: transparent;
}

.draftCard canvas {
  display: block;
  filter: drop-shadow(3px 4px 0 rgba(86, 81, 73, 0.22));
}

.draftCard:not(:disabled):active {
  transform: translateY(2px) rotate(-1deg);
}

.draftCard.waiting {
  opacity: 0.82;
}

.draftCard.choosing {
  transform: translateY(-6px) rotate(-1.5deg);
}

.draftCard.gone {
  visibility: hidden;
  animation: none;
}

.draftCard.unfit canvas {
  opacity: 0.4;
}

.draftUnfit {
  position: absolute;
  inset: auto 4px 38%;
  display: none;
  padding: 2px 4px;
  border: 1.5px solid var(--marker);
  background: #fffaf0;
  color: var(--marker);
  font-size: 11px;
  line-height: 1.1;
  transform: rotate(-4deg);
}

.draftCard.unfit .draftUnfit {
  display: block;
}

.draftTag {
  position: absolute;
  top: -13px;
  right: -4px;
  padding: 1px 6px;
  border: 1px solid rgba(140, 122, 74, 0.45);
  background: var(--sticky);
  color: var(--marker);
  font-size: 11px;
  white-space: nowrap;
  transform: rotate(4deg);
  box-shadow: 1px 2px 0 rgba(86, 81, 73, 0.18);
}

@keyframes draftFlipIn {
  0% { opacity: 0; transform: translateY(-14px) rotateY(80deg); }
  100% { opacity: 1; transform: none; }
}

/* The sent home card: crumpled into a paper ball, then dropped off the page. */
.draftCard.crumple {
  pointer-events: none;
  animation: draftCrumple 900ms cubic-bezier(0.5, 0, 0.9, 0.6) forwards;
}

.draftCard.crumple canvas {
  filter: grayscale(0.4) contrast(1.15);
}

@keyframes draftCrumple {
  0% {
    transform: none;
    clip-path: polygon(0% 0%, 25% 0%, 50% 0%, 75% 0%, 100% 0%, 100% 25%, 100% 50%, 100% 75%, 100% 100%, 75% 100%, 50% 100%, 25% 100%, 0% 100%, 0% 75%, 0% 50%, 0% 25%);
  }
  35% {
    transform: scale(0.62) rotate(-14deg);
    clip-path: polygon(12% 8%, 30% 18%, 52% 4%, 70% 16%, 92% 10%, 82% 30%, 96% 52%, 80% 70%, 90% 92%, 68% 82%, 48% 96%, 30% 84%, 8% 90%, 18% 68%, 4% 46%, 16% 28%);
  }
  55% {
    transform: scale(0.42) rotate(10deg);
    clip-path: polygon(24% 20%, 38% 26%, 52% 16%, 64% 26%, 80% 20%, 74% 36%, 84% 52%, 72% 64%, 80% 80%, 62% 74%, 50% 84%, 36% 74%, 20% 80%, 28% 64%, 16% 50%, 26% 36%);
  }
  100% {
    transform: translateY(110vh) scale(0.4) rotate(220deg);
    clip-path: polygon(24% 20%, 38% 26%, 52% 16%, 64% 26%, 80% 20%, 74% 36%, 84% 52%, 72% 64%, 80% 80%, 62% 74%, 50% 84%, 36% 74%, 20% 80%, 28% 64%, 16% 50%, 26% 36%);
  }
}

.draftGhost {
  position: fixed;
  z-index: 39;
  margin: 0;
  animation-delay: 0ms !important;
}

.draftFlight {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  transform-origin: top left;
  transition: transform 400ms cubic-bezier(0.3, 0.7, 0.3, 1);
}

.draftNeed {
  min-height: 1.2em;
  margin: 0;
  max-width: 320px;
  color: var(--pen-red);
  font-size: 13px;
  text-align: center;
}

.draftStatus {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 44px;
}

.draftBanner {
  padding: 4px 12px;
  border: 2px solid var(--marker);
  border-radius: 4px 9px 5px 8px;
  background: #fffaf0;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 20px;
  transform: rotate(-1.5deg);
}

.draftBanner.mine {
  background: var(--sticky);
}

.draftClock {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
}

.draftClock[hidden] {
  visibility: hidden;
  display: grid;
}

.draftClock svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.draftClock circle {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
}

.clockTrack {
  stroke: rgba(86, 81, 73, 0.18);
}

.clockArc {
  stroke: var(--graphite);
}

.draftClock.mine .clockArc {
  stroke: var(--pen-blue);
}

.draftClock.late .clockArc {
  stroke: var(--pen-red);
}

.draftClock span {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 19px;
}

.draftLeave {
  padding: 4px 10px;
  border: 1.5px solid rgba(86, 81, 73, 0.5);
  border-radius: 4px 7px 5px 6px;
  background: transparent;
  color: var(--graphite);
  font-family: "Paper Hand", cursive;
  font-size: 12px;
}

.draftPreview {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 6px;
  padding: 16px;
  background: rgba(255, 250, 240, 0.97);
  animation: draftFlipIn 260ms ease-out both;
}

.draftPreview h2 {
  margin: 0 0 6px;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 34px;
}

.previewCols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: min(100%, 420px);
}

.previewCols h3 {
  overflow: hidden;
  margin: 0 0 6px;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.previewDeck {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  justify-items: center;
}

.previewDeck canvas {
  max-width: 100%;
  height: auto !important;
}

.resultUnlock {
  margin: 4px 0 8px;
}

.resultUnlock p {
  margin: 4px 0 0 !important;
  color: var(--pen-blue);
  font-size: 14px !important;
}

.resultUnlockCards {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

/* ---------- Night 3: quests, weekly event ---------- */
#questsScreen[hidden] {
  display: none !important;
}

.questsMenuButton {
  position: relative;
  background: linear-gradient(180deg, #fffbea, #fbefc0 72%, #f1db8b) !important;
}

.eventMenuButton {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
  background: linear-gradient(180deg, #fff1ea, #fbd9c7 72%, #f1b99c) !important;
}

.eventMenuButton .eventKicker {
  font-size: 10px;
  letter-spacing: 0.08em;
  opacity: 0.75;
}

.eventMenuButton #eventButtonName {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.questList {
  display: grid;
  gap: 10px;
  margin: 8px 0 4px;
}

.questRow {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "text actions" "reward actions" "line line";
  gap: 2px 8px;
  padding: 10px 12px 6px;
  background: #fffaf0;
  border: 1.5px solid var(--marker, #26231f);
  border-radius: 10px 14px 9px 12px;
  box-shadow: 2px 3px 0 rgba(43, 40, 35, 0.16);
}

.questRow.done {
  background: #f6fbe9;
}

.questRow.claimed {
  opacity: 0.6;
}

.questText {
  grid-area: text;
  margin: 0;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 17px;
  line-height: 1.15;
}

.questReward {
  grid-area: reward;
  margin: 0;
  font-size: 12px;
  opacity: 0.75;
}

.questLine {
  grid-area: line;
  display: flex;
  align-items: center;
  gap: 6px;
}

.questBar {
  width: 200px;
  height: 34px;
  max-width: 70%;
}

.questCount {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 15px;
}

.questActions {
  grid-area: actions;
  align-self: center;
}

.questStamp {
  display: inline-block;
  padding: 2px 8px;
  border: 2px solid #3f8a4a;
  color: #3f8a4a;
  border-radius: 6px;
  transform: rotate(-6deg);
  font-family: "Marker Display", "Paper Hand", cursive;
}

.eventCard {
  margin: 14px 0 10px;
  padding: 12px 12px 10px;
  background: #fff3ea;
  border: 1.5px dashed #c0392b;
  border-radius: 12px;
}

.eventCard h2 {
  margin: 2px 0 4px;
  text-align: center;
  font-family: "Marker Display", "Paper Hand", cursive;
}

.eventBlurb {
  margin: 0 0 6px;
  text-align: center;
  font-size: 15px;
}


#replayOffer[hidden],
#replayBar[hidden],
#resultReplay[hidden] {
  display: none !important;
}

/* ---------- Instant replay ---------- */
.replayOffer {
  position: absolute;
  z-index: 40;
  /* Left, under your card: the right side is where the card recap and the emote bubbles go. */
  left: 14px;
  top: calc(env(safe-area-inset-top, 0px) + 210px);
  display: flex !important;
  flex-direction: column;
  align-items: center;
  min-height: 0 !important;
  padding: 8px 14px !important;
  background: #ffe9a6 !important;
  border: 1.5px solid var(--marker, #26231f) !important;
  border-radius: 4px !important;
  transform: rotate(-3deg);
  box-shadow: 3px 4px 0 rgba(43, 40, 35, 0.2);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 20px !important;
}

.replayOfferKind {
  font-size: 11px;
  letter-spacing: 0.06em;
  opacity: 0.8;
}

.replayBar {
  position: absolute;
  z-index: 45;
  left: 16px;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.replayStatus {
  grid-column: 1 / -1;
  margin: 0;
  min-height: 1.2em;
  text-align: center;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 15px;
  color: var(--marker, #26231f);
}

.replaying #cardRecap,
.replaying #playedCards,
.replaying #chipDetail,
.replaying #cardReveal,
.replaying #cardTray,
.replaying #hikeButton,
.replaying #puntButton,
.replaying #turboButton,
.replaying #patChoice,
.replaying #status,
.autoReplay #cardRecap,
.autoReplay #playedCards,
.autoReplay #chipDetail,
.autoReplay #cardReveal,
.autoReplay #patChoice,
.autoReplay #status {
  visibility: hidden;
}

.resultReplay {
  display: block;
  margin: 4px auto 8px;
}

.replayBar button {
  min-height: 48px;
  border: 2px solid var(--marker);
  border-radius: 4px 10px 6px 8px;
  background: linear-gradient(180deg, #fff3c9, var(--sticky) 72%, #efd98c);
  color: var(--marker);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 17px;
  box-shadow: 3px 4px 0 rgba(43, 40, 35, 0.18);
}

.replayBar button.ghost {
  background: #fffaf0;
}

.replayBar button:active {
  transform: translateY(2px) rotate(-0.6deg);
}

#squadScreen[hidden] {
  display: none !important;
}

/* ---------- Squads ---------- */
.squadMenuButton {
  background: linear-gradient(180deg, #f6efff, #e3d6fb 72%, #c9b4f1) !important;
}

.squadSection {
  margin: 8px 0 14px;
}

.badgePicker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-top: 8px;
}

.badgeChoice {
  display: grid;
  place-items: center;
  min-height: 0 !important;
  padding: 3px !important;
  background: transparent !important;
  border: 1.5px solid transparent !important;
  box-shadow: none !important;
}

.badgeChoice.picked {
  border-color: var(--marker, #26231f) !important;
  border-radius: 50%;
  background: #fffaf0 !important;
}

.squadBadge {
  width: 40px;
  height: 40px;
  flex: none;
}

.squadList {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.squadListItem,
.squadMember,
.requestRow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: #fffaf0;
  border: 1px solid #cdbb98;
  border-radius: 9px;
}

.squadListText,
.squadMemberText,
.requestText {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}

.squadListName,
.squadMemberName,
.requestWho {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.squadListMeta,
.squadMemberMeta,
.requestCount {
  font-size: 12px;
  opacity: 0.75;
}

.squadHead {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.squadHead .squadBadge {
  width: 52px;
  height: 52px;
}

.squadTitle h2 {
  margin: 0;
  font-family: "Marker Display", "Paper Hand", cursive;
  overflow-wrap: anywhere;
}

.squadTitle p {
  margin: 0;
}

.squadTabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 6px 0 8px;
}

.squadTab {
  min-height: 0 !important;
  padding: 6px 2px !important;
  font-size: 14px !important;
  opacity: 0.6;
}

.squadTab.active {
  opacity: 1;
  text-decoration: underline;
}

.squadMembers,
.requestList {
  display: grid;
  gap: 6px;
}

.onlineDot {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  border: 1.5px solid #8a8170;
  background: transparent;
}

.onlineDot.on {
  border-color: #2f8f45;
  background: #4cbb5f;
}

.squadChallenge,
.requestGive,
.squadJoin {
  flex: none;
}

.squadLeave {
  margin-top: 12px;
}

.requestPicker {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 6px 0 10px;
}

.requestCard {
  min-height: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.requestCard canvas,
.requestRow canvas {
  display: block;
}

.chatFeed {
  max-height: 200px;
  overflow-y: auto;
  padding: 6px 8px;
  margin-bottom: 8px;
  background: #fffaf0;
  border: 1px solid #cdbb98;
  border-radius: 9px;
}

.chatLine {
  margin: 2px 0;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.chatLine.chat-system {
  opacity: 0.6;
  font-style: italic;
}

.quickChat {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.quickLine {
  width: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 6px 10px !important;
  font-family: "Paper Hand", "Comic Sans MS", cursive !important;
  font-size: 15px !important;
  border-radius: 14px !important;
  background: #fffaf0 !important;
}

.quickEmotes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.quickEmote {
  width: 100% !important;
  white-space: nowrap;
}


/* ---------- Captains: the one time how to sticky note ---------- */
#captainsHowTo[hidden] {
  display: none !important;
}

.captainsHowTo {
  margin: 4px 0 12px;
  padding: 16px 14px 12px;
  border: 2px solid var(--marker);
  border-radius: 3px 3px 10px 4px;
  background: linear-gradient(180deg, #fff3c9, var(--sticky) 72%, #efd98c);
  box-shadow: 4px 6px 0 rgba(38, 35, 31, 0.22);
  color: var(--marker);
  transform: rotate(-1.2deg);
  text-align: left;
}

.captainsHowTo .howToTitle {
  margin: 0 0 6px;
  text-align: center;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 20px;
}

.captainsHowTo ol {
  margin: 0 0 10px;
  padding-left: 20px;
  font-size: 15px;
  line-height: 1.3;
}

.captainsHowTo button {
  display: block;
  margin: 0 auto;
}

/* ---------- Launch: welcome packs and the coach ---------- */
#welcomeScreen[hidden] {
  display: none !important;
}

.welcomeCard h1 {
  font-size: clamp(26px, 8vw, 36px);
}

.welcomePacks {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 8px 0 16px;
}

.welcomePack {
  flex: 0 0 auto;
  transform: rotate(-5deg);
  filter: drop-shadow(3px 4px 0 rgba(43, 40, 35, 0.28));
}

.welcomePack:nth-child(2) {
  transform: rotate(4deg) translateY(4px);
}

.welcomePack:nth-child(3) {
  transform: rotate(-1deg) scale(1.1);
}

@media (prefers-reduced-motion: reduce) {
  .callNote {
    animation: none;
  }
}

/* In the app, while the App Store is loading or can't sell: one line across the whole shelf. */
.storeUnavailable {
  grid-column: 1 / -1;
  margin: 8px 0;
}

/* ---------- Launch: real money waits behind a sticky note ---------- */
.comingSoon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  grid-column: 1 / -1;
  justify-self: stretch;
  box-sizing: border-box;
  width: 100%;
  margin: 6px 0;
  padding: 10px 14px;
  border: 2px solid var(--marker);
  border-radius: 3px 3px 10px 4px;
  background: linear-gradient(180deg, #fff3c9, var(--sticky) 72%, #efd98c);
  box-shadow: 3px 4px 0 rgba(38, 35, 31, 0.2);
  color: var(--marker);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 15px;
  line-height: 1.25;
  text-align: center;
  transform: rotate(-1.5deg);
}

.comingSoon.withInk {
  justify-content: flex-start;
  text-align: left;
}

.comingSoon .inkBottle {
  flex: 0 0 auto;
  width: 30px;
  height: 36px;
}

.comingSoonText {
  min-width: 0;
}

/* ---------- Launch: found a player while playing the CPU ---------- */
#quickFound[hidden],
#quickCpuNote[hidden] {
  display: none !important;
}

.quickFound {
  position: absolute;
  z-index: 70;
  left: 16px;
  right: 16px;
  top: calc(84px + var(--safe-top));
  padding: 12px 14px;
  border: 2px solid var(--marker);
  border-radius: 3px 3px 10px 4px;
  background: linear-gradient(180deg, #eefaf7, #c9ece4 72%, #9fd6c9);
  box-shadow: 4px 6px 0 rgba(38, 35, 31, 0.22);
  color: var(--marker);
  text-align: center;
  transform: rotate(-1deg);
  pointer-events: auto;
}

.quickFoundTitle {
  margin: 0;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 22px;
}

.quickFoundNote {
  margin: 2px 0 8px;
  font-size: 14px;
}

.quickFoundButtons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.quickFoundButtons button {
  min-height: 46px;
  border: 2px solid var(--marker);
  border-radius: 4px 10px 6px 8px;
  background: linear-gradient(180deg, #fff3c9, var(--sticky) 72%, #efd98c);
  color: var(--marker);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 15px;
}

.quickFoundButtons button.ghost {
  background: #fffaf0;
}

.quickFoundButtons button[hidden] {
  display: none;
}

/* ---------- Launch: add to home screen hint ---------- */
#installHint[hidden] {
  display: none !important;
}

.installHint {
  margin: 4px 0 10px;
  padding: 10px 12px;
  border: 2px dashed #2f5fb5;
  border-radius: 8px;
  background: #eef6ff;
  color: var(--marker);
  text-align: center;
}

.installHint p {
  margin: 0 0 6px;
  font-size: 15px;
  line-height: 1.25;
}

.installHintButtons {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.installHintButtons button[hidden] {
  display: none;
}

/* ---------- Age gate: first launch, before the account exists ---------- */
.ageGate {
  z-index: 90;
  background: var(--paper, #f3ead6);
}

.ageCard {
  width: min(420px, 100%);
}

.ageCard h1 {
  margin: 6px 0 16px;
  line-height: 1.1;
}

.ageTitle {
  display: grid;
  gap: 2px;
  justify-items: center;
}

.ageLead {
  font-family: "Paper Hand", cursive;
  font-size: 22px;
  color: var(--graphite);
}

/* Readable at a glance: big black marker on a highlighter stripe. */
.ageBig {
  display: inline-block;
  padding: 2px 14px 0;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: min(13.5vw, 64px);
  white-space: nowrap;
  line-height: 1;
  color: #15130f;
  letter-spacing: 0.01em;
  background: linear-gradient(176deg, transparent 0 34%, #ffe066 34% 86%, transparent 86%);
  transform: rotate(-2deg);
}

.ageButtons {
  display: grid;
  gap: 12px;
  margin: 8px 0 12px;
}

.ageButtons button {
  width: 100%;
}

.ageDoodle {
  display: block;
  width: 120px;
  margin: 0 auto 8px;
  color: var(--marker);
  transform: rotate(-8deg);
}

/* ---------- The new player guide: coach notes, title cards, the practice scoreboard ---------- */
#guideNote[hidden],
#guideRing[hidden],
#guideCard[hidden],
#guideWin[hidden],
#guideSkip[hidden],
#guideNoteButton[hidden] {
  display: none !important;
}

/* The coach: the Audible card's cut out art, cropped to his face. The numbers come from his face anchor in
   src/card-faces.js (x 0.45, y 0.2, zoom 2.7 on the square art): size = zoom, position = (0.5 - a x zoom) / (1 - zoom). */
.guideCoach {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border: 2.5px solid var(--marker);
  border-radius: 50%;
  background: #f6efdc url("/art/cards/web/audible.cut.webp") 42.06% 2.35% / 270% no-repeat;
  box-shadow: 2px 3px 0 rgba(38, 35, 31, 0.2);
}

.guideCoach.big {
  width: 92px;
  height: 92px;
}

.guideNote {
  position: absolute;
  left: calc(12px + var(--safe-left));
  right: calc(12px + var(--safe-right));
  top: calc(112px + var(--safe-top));
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 420px;
  margin: 0 auto;
  padding: 9px 12px;
  border: 2px solid var(--marker);
  border-radius: 3px 3px 12px 4px;
  background: linear-gradient(180deg, #fff3c9, var(--sticky) 72%, #efd98c);
  box-shadow: 4px 6px 0 rgba(38, 35, 31, 0.22);
  color: var(--marker);
  transform: rotate(-1deg);
  pointer-events: none;
  transition: top 0.35s ease, bottom 0.35s ease;
}

.guideNote::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 50%;
  width: 70px;
  height: 18px;
  margin-left: -35px;
  background: var(--tape);
  transform: rotate(3deg);
}

.guideNote.away {
  visibility: hidden;
}

.guideNote.atBottom {
  top: auto;
  bottom: calc(var(--tray-h) + 16px);
}

/* In a match: a short note laid over the scoreboard, above the field, never over the field or a player.
   A tap puts it away. */
.guideNote.inMatch {
  top: calc(max(30px, var(--safe-top) + 18px) - 24px);
  bottom: auto;
  left: calc(4px + var(--safe-left));
  right: calc(4px + var(--safe-right));
  box-sizing: border-box;
  height: 66px;
  max-width: none;
  padding: 5px 10px;
  gap: 8px;
  overflow: hidden;
  transform: none;
  pointer-events: auto;
  cursor: pointer;
}

.guideNote.inMatch::before {
  display: none;
}

/* During the play it moves down onto the card tray (no cards get played until the next snap). */
.livePlay .guideNote.inMatch,
.livePlay #coachCallNote {
  top: auto;
  bottom: calc(var(--safe-bottom) + 44px);
}

.guideNote.inMatch .guideCoach {
  width: 42px;
  height: 42px;
}

.guideNote.inMatch p {
  font-size: 16px;
  line-height: 1.1;
}

.guideNote p {
  flex: 1 1 auto;
  margin: 0;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 18px;
  line-height: 1.2;
}

.guideNote.praise p {
  color: var(--pen-blue);
}

.guideNote button {
  pointer-events: auto;
  min-height: 40px;
  padding: 2px 12px;
  border: 2px solid var(--marker);
  border-radius: 4px 8px 6px 6px;
  background: #fffaf0;
  font-family: "Marker Display", "Paper Hand", cursive;
}

.guideNote.pop {
  animation: guidePop 0.28s ease-out;
}

/* The Mississippi count under the coach's line (the rush rule): 1, 2, 3 MISSISSIPPI, lit in turn. */
.guideNote.hasCount {
  flex-wrap: wrap;
  row-gap: 4px;
}

.guideNote.inMatch.hasCount {
  height: auto;
  min-height: 66px;
}

/* The coach, the line and the button stay on one row; only the count wraps onto its own row. */
.guideNote.hasCount p {
  flex: 1 1 0;
  min-width: 0;
}

.guideCount {
  display: flex;
  flex: 1 0 100%;
  order: 3;
  justify-content: center;
  gap: 6px;
}

.guideCount[hidden] {
  display: none;
}

.guideCountChip {
  padding: 1px 8px;
  border: 1.5px solid var(--marker);
  border-radius: 40% 55% 45% 50%;
  background: #fffaf0;
  color: var(--graphite);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 15px;
  opacity: 0.45;
}

.guideCountChip.lit {
  opacity: 1;
  background: #ffe34d;
  color: var(--marker);
}

.guideCountChip.go.lit {
  background: #b8321f;
  color: #fffaf0;
}

.guideCount.looping .guideCountChip {
  animation: guideCountLoop calc((var(--n) + 1) * 1s) steps(1, end) infinite;
  animation-delay: calc(var(--i) * 1s);
}

@keyframes guideCountLoop {
  0% { opacity: 1; background: #ffe34d; color: var(--marker); }
  25% { opacity: 0.45; background: #fffaf0; color: var(--graphite); }
}

@media (prefers-reduced-motion: reduce) {
  .guideCount.looping .guideCountChip {
    animation: none;
    opacity: 1;
  }
}

@keyframes guidePop {
  from { opacity: 0; transform: rotate(-3deg) scale(0.92) translateY(-6px); }
}

.guideRing {
  position: absolute;
  z-index: 79;
  border: 3px solid #d0642a;
  border-radius: 14px 10px 16px 12px;
  pointer-events: none;
  animation: guidePulse 1.1s ease-in-out infinite;
}

.guideRing.round {
  border-radius: 48% 52% 46% 54%;
}

@keyframes guidePulse {
  50% { opacity: 0.45; transform: scale(1.04); }
}

.guideSkip {
  position: absolute;
  top: calc(8px + var(--safe-top));
  right: calc(10px + var(--safe-right));
  z-index: 88;
  min-height: 32px;
  padding: 2px 12px;
  border: 1.5px dashed rgba(38, 35, 31, 0.55);
  border-radius: 6px;
  background: rgba(255, 250, 240, 0.92);
  color: var(--graphite);
  font-family: "Paper Hand", cursive;
  font-size: 15px;
  letter-spacing: 0.06em;
}

.guideSkip.onField {
  top: auto;
  right: auto;
  left: calc(10px + var(--safe-left));
  bottom: calc(var(--tray-h) + 14px);
}

.guideSkip.onField.right {
  left: auto;
  right: calc(10px + var(--safe-right));
}

.guideSkip.onField.raised {
  bottom: calc(var(--tray-h) + 122px);
}

/* Title cards: full screen paper between the parts. */
.guideCard {
  position: absolute;
  inset: 0;
  z-index: 85;
  display: grid;
  place-items: center;
  padding: calc(24px + var(--safe-top)) 22px calc(24px + var(--safe-bottom));
  background: var(--paper);
  background-image: repeating-linear-gradient(0deg, transparent 0 31px, rgba(141, 133, 119, 0.2) 31px 32px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.guideCard.showing {
  opacity: 1;
}

.guideCard.leaving {
  opacity: 0;
}

.guidePaper {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: min(400px, 100%);
  text-align: center;
  transform: translateY(10px);
  transition: transform 0.4s ease;
}

.guideCard.showing .guidePaper {
  transform: none;
}

.guideKicker {
  margin: 0;
  color: var(--pen-blue);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 15px;
  letter-spacing: 0.1em;
}

.guideTitle {
  margin: 0;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: clamp(38px, 12vw, 54px);
  line-height: 1.02;
  color: var(--marker);
  transform: rotate(-2deg);
}

.guideSay {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.guideSay p {
  margin: 0;
  padding: 10px 12px;
  border: 2px solid var(--marker);
  border-radius: 3px 3px 12px 4px;
  background: linear-gradient(180deg, #fff3c9, var(--sticky) 72%, #efd98c);
  box-shadow: 3px 5px 0 rgba(38, 35, 31, 0.2);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 18px;
  line-height: 1.2;
  transform: rotate(1deg);
}

.guideDots {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.guideDots span {
  width: 14px;
  height: 14px;
  border: 2px solid var(--marker);
  border-radius: 50%;
  background: transparent;
}

.guideDots span.done {
  background: var(--marker);
}

.guideDots span.now {
  background: #d0642a;
  transform: scale(1.25);
}

/* YOU WIN: the practice scoreboard. */
.guideWin {
  z-index: 70;
}

.guideWin.showing .guideWinCard {
  animation: stampIn 0.35s ease-out;
}

.guideWinCard {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
}

.guideWinTitle {
  margin: 0;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: clamp(54px, 17vw, 72px) !important;
  line-height: 1;
  color: var(--pen-blue);
  transform: rotate(-3deg);
}

.guideScore {
  display: flex;
  gap: 26px;
  padding: 8px 22px;
  border: 2.5px solid var(--marker);
  border-radius: 6px 10px 8px 12px;
  background: #fffaf0;
  font-family: "Marker Display", "Paper Hand", cursive;
}

.guideScore span {
  display: grid;
  justify-items: center;
}

.guideScore small {
  font-size: 14px;
  color: var(--graphite);
}

.guideScore b {
  font-size: 44px;
  line-height: 1;
}

.guideWinCard button {
  width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .guideRing,
  .guideNote.pop,
  .guideWin.showing .guideWinCard {
    animation: none;
  }

  .guideCard,
  .guidePaper {
    transition: none;
  }
}

/* ---------- Home screen: the binder ---------- */
#mainMenu.binderOverlay {
  place-items: stretch center;
  background: #e9dfc8;
  padding: calc(8px + var(--safe-top)) 0 calc(10px + var(--safe-bottom)) calc(8px + var(--safe-left));
}

.binderCard.menuCard {
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  height: 100%;
  max-height: 100%;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
}

.binderCard.menuCard::before,
.binderCard.menuCard::after {
  display: none;
}

.binderTop {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 10px 6px 4px;
}

.binderTop .menuHeader {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  justify-content: flex-start;
  text-align: left;
}

.binderIcons {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.binderCard .doodleIcon {
  position: static;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  min-height: 0;
  margin: 0;
  padding: 4px;
  border: 2px solid var(--marker);
  border-radius: 50% 46% 52% 48%;
  background: #fffdf6;
  box-shadow: 2px 2px 0 rgba(86, 81, 73, 0.2);
}

.binderCard .doodleIcon svg {
  width: 100%;
  height: 100%;
}

.doodleIcon path,
.doodleIcon circle {
  fill: none;
  stroke: var(--marker);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.binderCard .speakerToggle.doodleIcon {
  flex-direction: row;
}

.binderCard .speakerToggle.doodleIcon span,
.binderCard .speakerToggle.doodleIcon small {
  display: none;
}

.binderCard .inviteBanner,
.binderCard .installHint {
  margin: 0 52px 6px 4px;
}

.binderBody {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  flex: 1 1 auto;
  min-height: 0;
}

.binderPages {
  position: relative;
  min-height: 0;
  border: 2px solid var(--marker);
  border-radius: 6px 4px 4px 10px;
  background: #fffaf0;
  box-shadow: 5px 6px 0 rgba(86, 81, 73, 0.2);
  perspective: 1600px;
}

.binderPage {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 14px 12px 18px 34px;
  border-radius: inherit;
  background-color: #fffaf0;
  /* Ruled school paper: blue lines, the red margin and the three binder holes. */
  background-image:
    radial-gradient(circle at 15px 12%, #d9cdb4 0 6px, rgba(38, 35, 31, 0.5) 6px 7.5px, transparent 8px),
    radial-gradient(circle at 15px 50%, #d9cdb4 0 6px, rgba(38, 35, 31, 0.5) 6px 7.5px, transparent 8px),
    radial-gradient(circle at 15px 88%, #d9cdb4 0 6px, rgba(38, 35, 31, 0.5) 6px 7.5px, transparent 8px),
    linear-gradient(90deg, transparent 27px, rgba(208, 80, 70, 0.55) 27px 29px, transparent 29px),
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(70, 120, 200, 0.16) 27px 28px);
  background-attachment: local;
  transform-origin: 0 50%;
  backface-visibility: hidden;
  -webkit-overflow-scrolling: touch;
  /* The page sets touch-action: none for the field; a binder page has to say it scrolls. */
  touch-action: pan-y;
}

.binderPage[hidden] {
  display: none;
}

.binderPage.turnAway,
.binderPage.turnBack {
  z-index: 2;
  overflow: hidden;
  box-shadow: 8px 0 18px rgba(38, 35, 31, 0.28);
}

/* Taps go to the page you turned to, never the one you're leaving. */
.binderPage.leaving,
.binderPage.leaving * {
  pointer-events: none !important;
}

.binderPage.turnAway {
  animation: pageTurnAway 0.38s cubic-bezier(0.4, 0, 0.7, 1) forwards;
}

.binderPage.turnBack {
  animation: pageTurnBack 0.38s cubic-bezier(0.3, 0, 0.6, 1) forwards;
}

@keyframes pageTurnAway {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(-98deg); opacity: 0.6; }
}

@keyframes pageTurnBack {
  from { transform: rotateY(-98deg); opacity: 0.6; }
  to { transform: rotateY(0deg); }
}

/* Divider tabs: colored paper sticking out past the right edge of the page. */
.binderTabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 0 18px;
}

.binderCard .binderTab {
  position: relative;
  width: 42px;
  min-height: 0;
  flex: 1 1 0;
  height: auto;
  max-height: 120px;
  margin: 0 0 0 -3px;
  padding: 6px 0;
  border: 2px solid var(--marker);
  border-left-width: 0;
  border-radius: 0 12px 10px 0;
  background: var(--tab, #fff3c9);
  box-shadow: 3px 3px 0 rgba(86, 81, 73, 0.2);
  font-size: 14px;
  letter-spacing: 0.08em;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: translateX(-4px);
  transition: transform 0.18s ease;
}

.binderCard .binderTab.active {
  z-index: 1;
  transform: translateX(0);
  box-shadow: 4px 3px 0 rgba(86, 81, 73, 0.25);
}

.binderCard .binderTab:active {
  transform: translateX(-2px);
}

.binderTab[data-tab="play"] { --tab: #ffe9a6; }
.binderTab[data-tab="binder"] { --tab: #cfe0fb; }
.binderTab[data-tab="store"] { --tab: #fbd3ad; }
.binderTab[data-tab="crew"] { --tab: #c9ece4; }
.binderTab[data-tab="events"] { --tab: #f7c9dc; }

.binderPage[data-page="play"] { --band: #ffe9a6; }
.binderPage[data-page="binder"] { --band: #cfe0fb; }
.binderPage[data-page="store"] { --band: #fbd3ad; }
.binderPage[data-page="crew"] { --band: #c9ece4; }
.binderPage[data-page="events"] { --band: #f7c9dc; }

/* The page's top edge in its tab's color, so tab and page read as one divider. */
.binderPage::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--band);
  border-bottom: 1.5px solid rgba(38, 35, 31, 0.35);
}

.tabDot {
  position: absolute;
  top: 6px;
  right: 5px;
  width: 11px;
  height: 11px;
  border: 1.5px solid #7a1d12;
  border-radius: 48% 52% 45% 55%;
  background: #e0402b;
  box-shadow: 0 0 0 2px rgba(255, 250, 240, 0.8);
}

.tabDot[hidden] {
  display: none;
}

.binderTab.attention .tabDot {
  animation: dotPulse 1.6s ease-in-out infinite;
}

@keyframes dotPulse {
  50% { transform: scale(1.25); }
}

.pageTitle {
  margin: 4px 0 8px;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: clamp(24px, 7vw, 32px);
  text-align: left;
  transform: rotate(-1.5deg);
}

/* An entry that's switched off (the Playbook Pass for now): display: grid below would beat [hidden]. */
.binderCard .binderEntry[hidden] {
  display: none;
}

/* BINDER, STORE, CREW, EVENTS entries: a title, a pencil note under it. */
.binderCard .binderEntry {
  position: relative;
  display: grid;
  justify-items: start;
  gap: 1px;
  min-height: 64px;
  padding: 8px 14px;
  text-align: left;
}

.entryTitle {
  font-size: clamp(18px, 5vw, 24px);
}

.entryNote {
  font-family: "Paper Hand", cursive;
  font-size: 14px;
  color: var(--graphite);
}

#deckButton {
  padding-right: 128px;
}

.deckPeek {
  position: absolute;
  right: 10px;
  top: 50%;
  display: flex;
  transform: translateY(-50%);
}

.deckPeek canvas {
  margin-left: -10px;
  transform: rotate(var(--tilt, 0deg));
}

.collectionMenuButton {
  background: linear-gradient(180deg, #f3f7ff, #d7e3fb 72%, #b8cdf3) !important;
}

/* LAYOUT AND PACKS: on a 13 sized phone the peek shrinks so the note stays on one line. */
@media (max-width: 430px) {
  .deckPeek {
    transform: translateY(-50%) scale(0.72);
    transform-origin: right center;
  }

  #deckButton {
    padding-right: 92px;
  }

  #deckButton .entryNote {
    font-size: 13px;
  }
}

@media (max-width: 380px) {
  .deckPeek {
    display: none;
  }

  #deckButton {
    padding-right: 14px;
  }
}

/* ---------- Home v2: the blue binder (design/home-mockup.png) ---------- */
/* The cover: blue vinyl with a little grain, showing around the page and behind the tabs. */
#mainMenu.binderOverlay {
  background-color: #2452b0;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1.6px),
    linear-gradient(140deg, #3266c6 0%, #2452b0 45%, #1b3f8f 100%);
  background-size: 5px 5px, 100% 100%;
  grid-template-columns: minmax(0, 1fr);
  padding: calc(8px + var(--safe-top)) calc(2px + var(--safe-right)) calc(10px + var(--safe-bottom)) calc(16px + var(--safe-left));
}

/* The page's top: logo on the left, coins and the doodle icons on the right. It's the same cream page as below. */
.binderTop {
  position: relative;
  align-items: flex-start;
  gap: 6px;
  margin-right: 46px;
  padding: 8px 8px 2px 16px;
  border: 2px solid var(--marker);
  border-bottom: 0;
  border-radius: 6px 4px 0 0;
  background: #fffaf0;
}

.binderLogo {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  display: grid;
  justify-items: start;
  padding: 0 0 2px;
  text-align: left;
}

.logoWord {
  position: relative;
  z-index: 1;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: clamp(24px, 7.2vw, 34px);
  line-height: 0.95;
  letter-spacing: -0.01em;
  color: #1f4fae;
  white-space: nowrap;
  transform: rotate(-3deg);
  text-shadow: 1px 1px 0 rgba(38, 35, 31, 0.25);
}

.logoSwoosh {
  position: absolute;
  left: 6px;
  top: clamp(28px, 8.6vw, 38px);
  width: clamp(110px, 34vw, 150px);
  height: 7px;
  border-radius: 6px 2px 8px 3px;
  background: #f3cf63;
  transform: rotate(-4deg) skewX(-20deg);
}

.logoRow {
  display: flex;
  align-items: flex-end;
  gap: 2px;
}

.logoBall {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  width: clamp(24px, 7vw, 34px);
  margin: 0 0 -4px -2px;
  transform: rotate(-14deg);
}

.logoBall path {
  fill: none;
  stroke: var(--marker);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.logoBall .ballBody {
  fill: #9a5a2c;
}

.logoBall path:not(.ballBody) {
  stroke: #fff8e8;
  stroke-width: 2;
}

.binderLogo .menuName {
  position: relative;
  z-index: 1;
  max-width: 100%;
  margin-top: 6px;
  font-family: "Paper Hand", cursive;
  font-size: 13px;
  color: var(--graphite);
}

.binderCorner {
  display: grid;
  justify-items: end;
  gap: 4px;
  flex: 0 0 auto;
}

.binderCorner .menuHeader {
  margin: 0;
  justify-content: flex-end;
}

.binderCard .coinPill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: auto;
  min-height: 0;
  margin: 0;
  padding: 3px 4px 3px 4px;
  border: 2px solid var(--marker);
  border-radius: 999px;
  background: #fffdf6;
  box-shadow: 2px 2px 0 rgba(86, 81, 73, 0.2);
  font-size: 16px;
  line-height: 1;
}

.coinDoodle {
  width: 20px;
  height: 20px;
  border: 2px solid #8a6410;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, #fff2b0 0 22%, #f3cf63 23% 60%, #d9a91f 61%);
}

.coinPlus {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--pen-blue);
  color: #fffaf0;
  font-size: 16px;
}

.binderCorner .inkStat {
  font-size: 14px;
}

.binderIcons {
  gap: 4px;
}

.binderCard .doodleIcon {
  width: 34px;
  height: 34px;
  padding: 3px;
}

/* Binder rings down the left edge, half on the cover and half through the page. */
.binderBody {
  overflow: visible;
}

.binderRings {
  position: absolute;
  top: 2%;
  bottom: 4%;
  left: -15px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}

.binderRings i {
  display: block;
  width: 26px;
  height: 13px;
  border: 3.5px solid #b9bec7;
  border-radius: 9px;
  background: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 1px 2px 0 rgba(20, 30, 60, 0.35);
  border-top-color: #e6e9ee;
}

.binderPages {
  border-top: 0;
  border-radius: 0 0 4px 10px;
  box-shadow: 5px 6px 0 rgba(10, 25, 70, 0.35);
}

/* Plain cream paper with a little grain; the ring holes sit under the rings. */
.binderPage {
  padding: 8px 10px 14px 22px;
  background-color: #fffaf0;
  background-image:
    radial-gradient(rgba(150, 130, 90, 0.07) 1px, transparent 1.4px),
    linear-gradient(90deg, rgba(38, 35, 31, 0.05) 0 12px, transparent 12px);
  background-size: 6px 6px, 100% 100%;
}

.binderPage::before {
  height: 4px;
}

/* Tabs: a doodle icon over the name. */
.binderTabs {
  padding: 4px 0 18px;
}

.binderCard .binderTab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  writing-mode: horizontal-tb;
  font-size: 12px;
}

.tabIcon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
}

.tabIcon path,
.tabIcon circle {
  fill: none;
  stroke: var(--marker);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.binderTab[data-tab="play"] .tabIcon path {
  fill: var(--marker);
}

.tabLabel {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 0.06em;
}

/* PLAY: a column from the top. With every mode listed under GAME MODES it scrolls on smaller phones. */
.binderPage[data-page="play"].active,
.binderPage[data-page="play"].turnAway,
.binderPage[data-page="play"].turnBack {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 10px;
}

/* The league strip: a piece of masking tape with a mini field and your yard line. */
.binderCard .leagueStrip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 50px;
  margin: 2px -2px 0;
  padding: 5px 10px 5px 12px;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 40%),
    rgba(232, 219, 180, 0.92);
  box-shadow: 1px 2px 0 rgba(86, 81, 73, 0.18);
  clip-path: polygon(0 6%, 2% 0, 4% 8%, 6% 1%, 94% 0, 96% 7%, 98% 0, 100% 5%, 99% 50%, 100% 95%, 98% 100%, 96% 93%, 94% 100%, 6% 99%, 4% 92%, 2% 100%, 0 94%, 1% 50%);
  text-align: left;
  transform: rotate(-0.8deg);
}

.leagueText {
  display: grid;
  flex: 0 0 auto;
  max-width: 50%;
  line-height: 1;
}

.leagueText b {
  overflow: hidden;
  font-weight: normal;
  font-size: clamp(13px, 3.8vw, 18px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leagueYards {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: clamp(13px, 3.6vw, 16px);
  color: var(--pen-blue);
}

.leagueField {
  flex: 1 1 auto;
  min-width: 60px;
  max-width: 100%;
}

.binderCard .leagueGo {
  flex: 0 0 auto;
  font-size: 11px;
  line-height: 1.05;
  color: var(--pen-blue);
  text-align: center;
  transform: rotate(4deg);
}

/* The big blue PLAY button, with a pencil play drawn in the space beside it. */
.playRow {
  display: grid;
  grid-template-columns: minmax(48px, 0.55fr) minmax(0, 1.45fr);
  align-items: center;
  gap: 6px;
  flex: 0 1 auto;
  height: clamp(84px, 16vh, 150px);
  min-height: 70px;
}

.playDoodle {
  width: 100%;
  max-height: 100%;
  opacity: 0.75;
}

.playDoodle path,
.playDoodle circle {
  fill: none;
  stroke: var(--graphite);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.binderCard .bigPlay {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  height: 100%;
  min-height: 78px;
  margin: 0;
  border: 3px solid #102a66;
  border-radius: 16px 12px 18px 12px;
  background: linear-gradient(180deg, #4a7fdc 0%, #2a5cc0 55%, #1e47a0 100%);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.35), inset 0 -4px 0 rgba(10, 25, 70, 0.3), 4px 5px 0 rgba(10, 25, 70, 0.35);
  color: #fffaf0;
  transform: rotate(-1deg);
}

.bigPlayWord {
  position: relative;
  font-size: clamp(40px, 13vw, 58px);
  line-height: 0.9;
  letter-spacing: 0.02em;
  text-shadow: 2px 3px 0 rgba(10, 25, 70, 0.45);
  transform: rotate(-4deg);
}

.bigPlayWord::after {
  content: "";
  position: absolute;
  left: 4%;
  right: -2%;
  bottom: -5px;
  height: 7px;
  border-radius: 6px 2px 8px 3px;
  background: #f3cf63;
  transform: rotate(-3deg) skewX(-24deg);
}

.binderCard .bigPlay small {
  margin-top: 6px;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: clamp(13px, 3.8vw, 17px);
  color: #fffaf0;
  letter-spacing: 0.04em;
}

/* GAME MODES: the big PLAY (quick play) first, then one sticky note per mode. Every mode says what it is in one
   line and wears a rubber stamp tag (RANKED, SOLO, VS FRIEND, EVENT), so a new player knows before tapping. */
.gameModes {
  display: grid;
  gap: 6px;
  flex: 0 0 auto;
}

.modesHeader {
  position: relative;
  justify-self: start;
  margin: 2px 0 0 2px;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: clamp(19px, 5.6vw, 24px);
  font-weight: normal;
  letter-spacing: 0.04em;
  line-height: 1;
  transform: rotate(-1.2deg);
}

/* A highlighter swipe under the header. */
.modesHeader::after {
  content: "";
  position: absolute;
  left: -3px;
  right: -6px;
  bottom: -1px;
  z-index: -1;
  height: 9px;
  border-radius: 6px 2px 8px 3px;
  background: rgba(243, 207, 99, 0.75);
  transform: rotate(-1.5deg) skewX(-18deg);
}

.modeHeroLine {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 2px 2px;
  line-height: 1.15;
}

.modeTag {
  flex: 0 0 auto;
  padding: 1px 5px 0;
  border: 2px solid currentColor;
  border-radius: 4px 6px 3px 7px;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 11px;
  letter-spacing: 0.06em;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0.88;
  transform: rotate(-3deg);
}

[data-mode-tag="ranked"] .modeTag { color: var(--pen-blue); }
[data-mode-tag="solo"] .modeTag { color: #2e7a45; }
[data-mode-tag="friend"] .modeTag { color: var(--pen-red); }
[data-mode-tag="event"] .modeTag { color: #7a3fa0; }

.modeDesc {
  font-family: "Paper Hand", cursive;
  font-size: 13px;
  line-height: 1.15;
  color: var(--graphite);
  text-align: left;
  /* A line too long for a small phone breaks into even halves, not one stray word. */
  text-wrap: balance;
}

.modeList {
  display: grid;
  gap: 7px;
  margin-top: 2px;
}

.binderCard .modeCard {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  grid-template-areas: "icon name tag" "icon desc desc";
  align-items: center;
  column-gap: 8px;
  row-gap: 1px;
  min-height: 50px;
  margin: 0;
  padding: 6px 10px 6px 8px;
  border: 1.5px solid rgba(38, 35, 31, 0.7);
  border-radius: 2px 3px 2px 10px;
  background: var(--note-color, #fff3a6);
  box-shadow: 2px 3px 0 rgba(86, 81, 73, 0.22);
  color: var(--marker);
  text-align: left;
}

.binderCard .modeCard.captainsMenuButton {
  background: var(--note-color) !important;
}

.modeList .modeCard:nth-child(5n + 1) { --note-color: #d6f2c6; transform: rotate(-0.6deg); }
.modeList .modeCard:nth-child(5n + 2) { --note-color: #fff3a6; transform: rotate(0.5deg); }
.modeList .modeCard:nth-child(5n + 3) { --note-color: #ffd9e4; transform: rotate(-0.4deg); }
.modeList .modeCard:nth-child(5n + 4) { --note-color: #e6dcfa; transform: rotate(0.6deg); }
.modeList .modeCard:nth-child(5n + 5) { --note-color: #d7e8fb; transform: rotate(-0.5deg); }

/* A strip of tape holding each note on. */
.modeList .modeCard::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  width: 30px;
  height: 11px;
  background: var(--tape);
  transform: translateX(-50%) rotate(-4deg);
}

.modeCard svg {
  grid-area: icon;
  width: 34px;
  height: 24px;
}

.modeCard svg path,
.modeCard svg circle {
  fill: none;
  stroke: var(--marker);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.modeCard .capFill {
  fill: var(--pen-blue);
}

.modeCard .coneFill {
  fill: var(--juice);
}

.modeName {
  grid-area: name;
  overflow: hidden;
  font-size: clamp(15px, 4.4vw, 19px);
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modeCard .modeTag {
  grid-area: tag;
  justify-self: end;
}

.modeCard .modeDesc {
  grid-area: desc;
}

/* The clear plastic card sleeve: 3 deck cards, the free pack and the pack slots in their pockets. */
.cardSleeve {
  position: relative;
  flex: 0 0 auto;
  margin: 0 -4px;
  padding: 4px 6px 8px;
  border: 2px solid rgba(38, 35, 31, 0.55);
  border-radius: 5px 5px 6px 4px;
  background:
    linear-gradient(118deg, rgba(255, 255, 255, 0.55) 0 14%, rgba(214, 228, 244, 0.28) 14% 37%, rgba(255, 255, 255, 0.5) 37% 41%, rgba(210, 224, 242, 0.3) 41% 100%);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.5), 2px 3px 0 rgba(86, 81, 73, 0.16);
}

/* The plastic's shine, over everything in the pockets. */
.cardSleeve::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(125deg, transparent 0 22%, rgba(255, 255, 255, 0.28) 24% 27%, transparent 29% 62%, rgba(255, 255, 255, 0.22) 64% 66%, transparent 68%);
  pointer-events: none;
}

.binderCard .sleeveHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 0;
  margin: 0 0 3px;
  padding: 2px 2px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.sleeveTitle {
  overflow: hidden;
  font-size: clamp(12px, 3.5vw, 17px);
  color: #1f4fae;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: rotate(-1deg);
}

.sleeveTape {
  flex: 0 0 auto;
  padding: 1px 6px;
  background: rgba(243, 214, 108, 0.85);
  font-size: 13px;
  transform: rotate(-3deg);
}

.sleeveCards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.pocket {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 3px;
  border: 1.5px solid rgba(110, 135, 170, 0.55);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.pocket[hidden] {
  display: none;
}

.cardPocket canvas {
  display: block;
}

/* LAYOUT AND PACKS: the free pack gets its own full width row (art left, FREE PACK and its timer right), and the
   4 pack slots sit in a row of their own below it. */
.sleevePacks {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
  margin-top: 5px;
}

.sleevePacks .packPocket {
  height: clamp(66px, 9.5vh, 96px);
}

.sleevePacks .pocket {
  overflow: hidden;
}

.binderCard .packPocket .freePack {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(10px, 4vw, 22px);
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 2px;
  border: 0;
  background: transparent;
  box-shadow: none;
  animation: none;
}

.binderCard .packPocket .freePack.ready canvas {
  animation: packBounce 1.2s ease-in-out infinite;
}

.freePackText {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 5px 10px;
  min-width: 0;
  padding-right: 6px;
}

.freePackText b {
  font-weight: normal;
  font-size: clamp(14px, 4vw, 18px);
  line-height: 1;
  transform: rotate(-3deg);
}

.ripIt {
  padding: 3px 8px;
  border: 2px solid var(--marker);
  border-radius: 999px;
  background: #fffdf6;
  font-size: 13px;
  white-space: nowrap;
  color: var(--graphite);
}

.freePack.ready .ripIt {
  background: #c8eebd;
  color: var(--marker);
  box-shadow: 2px 2px 0 rgba(86, 81, 73, 0.25);
}

.freePack.ready .ripIt::after {
  content: " >";
}

.binderCard .slotsPocket .packSlots {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(4px, 1.6vw, 8px);
  width: 100%;
}

.binderCard .slotsPocket .packSlot {
  padding: 1px 1px 0;
  border-width: 1.5px;
  font-size: 11px;
  line-height: 1.1;
}

/* The page curl lives in the sleeve's bottom margin, under nothing. */
.cardSleeve {
  padding-bottom: 18px;
}

.sleeveCurl {
  position: absolute;
  right: -2px;
  bottom: -2px;
  z-index: 1;
  width: 18px;
  height: 18px;
  border-top-left-radius: 14px;
  background: linear-gradient(315deg, #fffaf0 0 46%, rgba(255, 255, 255, 0.95) 48%, rgba(196, 212, 236, 0.95) 80%);
  box-shadow: -2px -2px 3px rgba(38, 35, 31, 0.14);
  pointer-events: none;
}

.binderPage[data-page="play"] .packNote {
  flex: 0 0 auto;
  min-height: 0;
  margin: 0;
  font-size: 13px;
}

.binderPage[data-page="play"] .packNote:empty {
  display: none;
}

/* Short phones (iPhone SE): tighter everything so PLAY still fits. */
@media (max-height: 700px) {
  .binderTop {
    padding-top: 5px;
  }

  .logoWord {
    font-size: clamp(26px, 8vw, 32px);
  }

  .binderCard .leagueStrip {
    min-height: 44px;
    padding-top: 3px;
    padding-bottom: 3px;
  }

  .playRow {
    min-height: 70px;
  }

  .binderCard .bigPlay {
    min-height: 68px;
  }
}

/* ---------- THE DRIVE: one hand drawn field per league, rewards on the yard lines ---------- */
.driveField {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 8px 0 12px;
  border: 2px solid var(--marker);
  border-radius: 4px;
  overflow: hidden;
}

.driveLeague {
  position: relative;
  background-color: #fffaf0;
  background-size: 160px 160px;
  border-top: 3px solid var(--marker);
}

.driveLeague:first-child {
  border-top: 0;
}

.driveLeague:not(.reached) > :not(.driveSvg):not(.driveEndZone):not(.driveLeagueName) {
  opacity: 0.6;
}

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

.driveSvg path {
  fill: none;
  stroke-linecap: round;
}

.driveLine {
  stroke: var(--graphite);
  stroke-width: 1.6;
  opacity: 0.75;
}

.driveLine.minor {
  stroke-width: 1;
  opacity: 0.4;
}

.driveGoal {
  stroke: var(--marker);
  stroke-width: 3.2;
}

.driveSide {
  stroke: var(--marker);
  stroke-width: 2.4;
}

.driveTick {
  stroke: var(--graphite);
  stroke-width: 1;
  opacity: 0.45;
}

.driveHatch {
  stroke: var(--pen-red);
  stroke-width: 1.4;
  opacity: 0.35;
}

.driveNumber {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 17px;
  fill: var(--graphite);
  text-anchor: middle;
  opacity: 0.8;
}

.driveEndZone {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  place-items: center;
  align-content: center;
  height: 9.7%;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 15px;
  color: var(--pen-red);
  text-align: center;
  pointer-events: none;
}

.driveEndZone b {
  font-weight: normal;
  font-size: clamp(20px, 6vw, 28px);
  letter-spacing: 0.08em;
  transform: rotate(-2deg);
}

.driveEndZone span {
  font-family: "Paper Hand", cursive;
  font-size: 13px;
  color: var(--marker);
}

.driveLeague.endless .driveEndZone {
  color: var(--gold);
}

.driveLeagueName {
  position: absolute;
  left: 50%;
  bottom: 4px;
  padding: 0 8px;
  background: rgba(255, 250, 240, 0.9);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 13px;
  white-space: nowrap;
  transform: translateX(-50%) rotate(-1deg);
}

.driveMarker {
  position: absolute;
  left: 34%;
  right: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 2px 6px 2px 4px;
  border: 1.5px solid rgba(38, 35, 31, 0.6);
  border-radius: 4px 8px 5px 7px;
  background: rgba(255, 253, 246, 0.94);
  font-size: 14px;
  text-align: left;
  transform: translateY(-50%);
}

.driveFlag {
  flex: 0 0 auto;
  width: 12px;
  height: 22px;
  border-left: 2.5px solid var(--marker);
  background: linear-gradient(var(--juice), var(--juice)) no-repeat 0 0 / 11px 9px;
}

.driveReward {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.1;
}

.driveMarker.claimed {
  opacity: 0.6;
}

.driveMarker.ready {
  border-color: var(--marker);
  background: #fff6c8;
  box-shadow: 2px 2px 0 rgba(86, 81, 73, 0.25);
}

.driveMarker.next {
  border-style: dashed;
  border-color: var(--pen-blue);
}

.driveMarker .claimButton {
  flex: 0 0 auto;
  width: auto;
  min-height: 28px;
  margin: 0;
  padding: 0 8px;
  font-size: 14px;
}

.driveCheck,
.driveLeft {
  flex: 0 0 auto;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 12px;
  color: var(--graphite);
}

.driveCheck {
  color: #2e7d4f;
}

.driveBall {
  position: absolute;
  left: 15%;
  z-index: 2;
  display: grid;
  justify-items: center;
  transform: translateY(-50%);
  pointer-events: none;
}

.driveBall svg {
  width: 40px;
  height: 24px;
  filter: drop-shadow(1px 2px 0 rgba(38, 35, 31, 0.3));
  animation: packBounce 1.4s ease-in-out infinite;
}

.driveBall .ballBody {
  fill: #9a5a2c;
  stroke: var(--marker);
  stroke-width: 2;
}

.driveBall .ballLace {
  stroke: #fff8e8;
  stroke-width: 1.8;
}

.driveBall span {
  padding: 0 4px;
  background: var(--pen-blue);
  color: #fffaf0;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 11px;
  white-space: nowrap;
}

/* ---------- Touchdown promotion ---------- */
.tdPromo {
  overflow: hidden;
}

.tdConfetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tdConfetti i {
  position: absolute;
  top: -20px;
  left: var(--x);
  width: 9px;
  height: 14px;
  border: 1.5px solid var(--marker);
  background: var(--c);
  opacity: 0;
  transform: rotate(var(--r));
}

#leagueUp.celebrate .tdConfetti i {
  animation: tdConfetti 2.4s ease-in var(--d) both;
}

@keyframes tdConfetti {
  0% { opacity: 1; transform: translateY(0) rotate(var(--r)); }
  100% { opacity: 0.9; transform: translateY(110vh) rotate(calc(var(--r) + 540deg)); }
}

.leagueCard .tdWord {
  margin: 0;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: clamp(40px, 13vw, 64px);
  line-height: 1;
  color: var(--pen-red);
  text-shadow: 3px 3px 0 rgba(38, 35, 31, 0.2);
  transform: rotate(-4deg);
}

#leagueUp.celebrate .tdWord {
  animation: tdSlam 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

@keyframes tdSlam {
  from { opacity: 0; transform: scale(2.6) rotate(-12deg); }
  to { opacity: 1; transform: scale(1) rotate(-4deg); }
}

.tdPosts {
  display: block;
  width: 150px;
  height: 92px;
  margin: 2px auto 0;
}

.tdPosts path {
  fill: none;
  stroke: var(--gold);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tdPosts .tdBall {
  fill: #9a5a2c;
  stroke: var(--marker);
  stroke-width: 2;
}

#leagueUp.celebrate .tdPosts .tdKick {
  animation: tdKick 1s 0.35s cubic-bezier(0.3, 0.1, 0.4, 1) both;
}

@keyframes tdKick {
  from { transform: translate(0, 70px) scale(1.4) rotate(0deg); }
  to { transform: translate(0, 0) scale(0.7) rotate(720deg); }
}

.tdKick {
  transform-box: fill-box;
  transform-origin: center;
}

/* ---------- Card inspect: the card zoomed to the middle, a real 3D flip to its back ---------- */
.srOnly {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.cardInspect {
  position: absolute;
  inset: 0;
  z-index: 76;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: calc(12px + var(--safe-top)) 16px calc(12px + var(--safe-bottom));
  overflow-y: auto;
  background: rgba(43, 40, 35, 0.62);
}

.cardInspect[hidden] {
  display: none;
}

.inspectPanel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.inspectStage {
  perspective: 1100px;
}

.inspectFlip {
  position: relative;
  display: block;
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-y;
  outline: none;
}

/* The flip turns the card edge on, swaps the face, and turns it back (card-inspect.js), so it doesn't lean on
   backface-visibility, which WebKit drops for these canvases. */
.inspectFace {
  display: block;
  /* The lift: a soft shadow under the raised card. */
  filter: drop-shadow(0 14px 18px rgba(20, 16, 10, 0.45));
}

.inspectBackFace,
.inspectFlip.flipped .inspectFront {
  display: none;
}

.inspectFlip.flipped .inspectBackFace {
  display: block;
}

.inspectHint {
  margin: 0;
  font-size: 14px;
  color: #fffaf0;
  opacity: 0.85;
}

.inspectNote[hidden],
.inspectActions[hidden] {
  display: none;
}

.inspectNote {
  max-width: 300px;
  margin: 0;
  padding: 4px 8px;
  border: 1.5px dashed rgba(255, 250, 240, 0.7);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 14px;
  color: #fffaf0;
}

.inspectActions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 320px;
}

.inspectActions button {
  min-width: 112px;
  min-height: 44px;
  padding: 6px 16px;
  border: 2px solid var(--marker);
  border-radius: 7px 11px 8px 12px;
  background: #fffaf0;
  box-shadow: 3px 4px 0 rgba(20, 16, 10, 0.35);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 18px;
  color: var(--marker);
}

.inspectActions button.primary {
  background: var(--pen-blue);
  color: #fffaf0;
}

.inspectActions button.ready {
  background: #f6d672;
}

.inspectActions button:disabled {
  opacity: 0.55;
}

.inspectActions small {
  display: block;
  font-family: "Paper Hand", cursive;
  font-size: 12px;
}

.inspectClose {
  margin: 0;
  font-size: 14px;
  color: #fffaf0;
}

/* ---------- Cosmetic previews that move: emotes loop their pop ---------- */
.emoteThumb.looping .emoteArt {
  transform-origin: 50% 60%;
  animation: emoteLoop 2.4s ease-in-out infinite;
  animation-delay: var(--loop-delay, 0s);
}

.emoteThumb.looping .tear,
.emoteThumb.looping .steam,
.emoteThumb.looping .zz,
.emoteThumb.looping .boom,
.emoteThumb.looping .glint,
.emoteThumb.looping .cash {
  animation: emotePart 1.2s ease-in-out infinite;
  animation-delay: var(--loop-delay, 0s);
}

.emoteThumb.looping .heart {
  transform-origin: 50% 55%;
  animation: emoteBeat 0.8s ease-in-out infinite;
}

@keyframes emoteLoop {
  0% { transform: scale(0.45) rotate(-12deg); opacity: 0.6; }
  12% { transform: scale(1.12) rotate(4deg); opacity: 1; }
  20% { transform: scale(1) rotate(0deg); }
  45% { transform: rotate(-5deg); }
  60% { transform: rotate(5deg) translateY(-2px); }
  75% { transform: rotate(0deg); }
  92% { transform: translateY(-4px); opacity: 1; }
  100% { transform: translateY(-6px) scale(0.9); opacity: 0.6; }
}

@keyframes emotePart {
  50% { transform: translateY(-3px); opacity: 0.45; }
}

@keyframes emoteBeat {
  30% { transform: scale(1.14); }
  60% { transform: scale(0.96); }
}

@media (prefers-reduced-motion: reduce) {
  .emoteThumb.looping .emoteArt,
  .emoteThumb.looping .emoteArt * {
    animation: none !important;
  }
}

/* While the guide is up its SKIP sits in the top corner: the binder's icons make room for it. */
#app.guiding .binderIcons {
  margin-right: 58px;
}

/* ---------- Friend flow: name pick, the joining line, friend codes, the friend result ---------- */
.namePick,
.tutorialOffer {
  z-index: 86;
  background: var(--paper, #f3ead6);
}

.namePickCard,
.tutorialOfferCard {
  display: grid;
  gap: 10px;
  width: min(400px, 100%);
}

.namePickCard h1,
.tutorialOfferCard h1 {
  margin: 0;
}

#namePickInput {
  width: 100%;
  min-height: 52px;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 24px;
  text-align: center;
}

.namePickKeep {
  width: 100%;
  min-height: 56px;
  font-size: 24px;
}

.tutorialOfferCard button {
  width: 100%;
}

.lobbyJoining {
  margin: 4px 0 8px;
  padding: 6px 10px;
  border: 2px dashed var(--pen-blue);
  border-radius: 8px 12px 9px 11px;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 17px;
  color: var(--pen-blue);
  animation: joiningPulse 1.4s ease-in-out infinite;
}

.lobbyJoining[hidden] {
  display: none;
}

@keyframes joiningPulse {
  50% { opacity: 0.6; }
}

@media (prefers-reduced-motion: reduce) {
  .lobbyJoining {
    animation: none;
  }
}

.friendCode {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 28px;
  white-space: nowrap;
  letter-spacing: 0.06em;
  color: var(--marker);
  background: linear-gradient(176deg, transparent 0 30%, #ffe066 30% 88%, transparent 88%);
  padding: 0 6px;
}

.friendCodeBox {
  margin: 4px 0 10px;
  text-align: center;
}

.friendCodeRow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 2px 0 0;
}

.friendCodeAdd {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.friendCodeAdd input {
  flex: 1;
  min-width: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.crewCode {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 10px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 2px solid var(--marker);
  border-radius: 7px 12px 8px 11px;
  background: #fffaf0;
  box-shadow: 3px 3px 0 rgba(38, 35, 31, 0.18);
  transform: rotate(-0.6deg);
}

.crewCodeLabel {
  grid-column: 1 / -1;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 13px;
  color: var(--graphite);
}

.crewCodeValue {
  justify-self: start;
  font-size: clamp(24px, 8vw, 34px);
}

.copyCode {
  min-width: 76px;
}

.addFriendButton {
  margin: 4px auto 6px;
  background: var(--sticky, #ffe98a);
}

.addFriendButton[hidden],
.resultWelcome[hidden] {
  display: none;
}

.resultWelcome {
  margin: 6px 0 8px;
  padding: 8px 10px;
  border: 2px dashed var(--marker);
  border-radius: 8px;
  background: rgba(255, 233, 138, 0.5);
}

.resultWelcome p {
  margin: 0 0 6px;
}

/* After a friend match: REMATCH is the big button and the head to head record sits right under the score. */
#resultScreen.friendMatch .resultRecord {
  display: inline-block;
  margin: 4px 0 8px;
  padding: 2px 10px;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: clamp(16px, 4.6vw, 22px);
  background: linear-gradient(176deg, transparent 0 30%, #ffe066 30% 88%, transparent 88%);
}

#resultScreen.friendMatch .resultButtons {
  flex-direction: column;
  align-items: stretch;
}

#resultScreen.friendMatch #rematchButton {
  min-height: 72px;
  font-size: clamp(28px, 8vw, 38px);
  background: var(--pen-blue);
  color: #fffaf0;
  box-shadow: 4px 5px 0 rgba(20, 16, 10, 0.35);
}

#resultScreen.friendMatch #menuButton {
  align-self: center;
  min-width: 120px;
  min-height: 40px;
  font-size: 16px;
}

/* ---------- STORE AND RANKS ---------- */
/* RANKS: a scoreboard sheet. The list scrolls inside the card; your row pins along the bottom when it's off screen. */
#ranksScreen[hidden] {
  display: none !important;
}

.ranksMenuButton {
  position: relative;
  background: linear-gradient(180deg, #f1f4ff, #d6def8 72%, #b4c3ef) !important;
}

.ranksDoodle {
  position: absolute;
  right: 10px;
  bottom: 6px;
  width: 44px;
  height: 26px;
  fill: none;
  stroke: var(--marker);
  stroke-width: 2.2;
  stroke-linejoin: round;
  opacity: 0.55;
}

.ranksCard {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 760px;
  overflow: hidden;
}

.ranksTabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 2px 0 6px;
}

.menuCard .ranksTabs button {
  width: auto;
  margin: 0;
  min-height: 38px;
  padding: 4px 2px;
  border: 2px solid var(--marker);
  border-radius: 8px 10px 4px 4px;
  background: #efe6d1;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: clamp(12px, 3.6vw, 15px);
  opacity: 0.75;
}

.ranksTabs button[aria-selected="true"] {
  background: #fff6c8;
  opacity: 1;
  transform: translateY(-2px) rotate(-1deg);
  box-shadow: 2px 3px 0 rgba(38, 35, 31, 0.2);
}

.menuCard .ranksNote {
  min-height: 1.2em;
  margin: 2px 0 6px;
}

.ranksList {
  flex: 1 1 auto;
  min-height: 120px;
  margin: 0;
  padding: 2px 2px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  border-top: 1.5px dashed rgba(38, 35, 31, 0.35);
  -webkit-overflow-scrolling: touch;
}

.rankLeagueTape {
  width: max-content;
  margin: 10px 0 4px -2px;
  padding: 1px 10px;
  background: var(--tape);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 12px;
  letter-spacing: 0.04em;
  transform: rotate(-1.5deg);
}

.rankRow {
  display: grid;
  grid-template-columns: 30px 30px minmax(0, 1fr) 56px 34px;
  gap: 6px;
  align-items: center;
  min-height: 44px;
  padding: 3px 6px;
  border-bottom: 1px solid rgba(47, 95, 181, 0.22);
}

.rankRow.me {
  border: 2px solid var(--marker);
  border-radius: 6px 9px 5px 8px;
  background: linear-gradient(176deg, #fff3a8, #ffe066);
  box-shadow: 2px 3px 0 rgba(38, 35, 31, 0.18);
}

.rankNumber {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 18px;
  text-align: center;
}

.rankNumber.long {
  font-size: 14px;
}

.rankYou {
  margin-right: 5px;
  padding: 0 4px;
  border-radius: 3px;
  background: var(--marker);
  color: #ffe066;
  font-size: 10px;
  letter-spacing: 0.05em;
}

.rankRow.top1 .rankNumber,
.rankRow.top2 .rankNumber,
.rankRow.top3 .rankNumber {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--marker);
  border-radius: 50% 46% 52% 48%;
  font-size: 15px;
}

.rankRow.top1 .rankNumber { background: #f3cf63; }
.rankRow.top2 .rankNumber { background: #dcdcd6; }
.rankRow.top3 .rankNumber { background: #e1a774; }

.rankWho {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.1;
}

.rankName {
  overflow: hidden;
  font-size: 16px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.rankLeague {
  font-size: 12px;
  opacity: 0.75;
}

.rankYards {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1;
}

.rankYards b {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 17px;
  font-weight: normal;
}

.rankYards small {
  font-size: 10px;
  opacity: 0.7;
}

.miniField {
  width: 56px;
  height: 14px;
  overflow: visible;
}

.miniField path {
  fill: none;
  stroke: var(--marker);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.miniField .miniTurf {
  fill: rgba(46, 125, 79, 0.16);
  stroke-width: 1.2;
}

.miniField .miniZone {
  fill: rgba(47, 95, 181, 0.16);
  stroke-width: 1.2;
}

.miniField .miniHatch,
.miniField .miniLine {
  stroke-width: 0.7;
  opacity: 0.6;
}

.miniField .miniBall {
  fill: #9a5a2c;
  stroke-width: 1.1;
}

.miniField .miniLace {
  stroke: #fffaf0;
  stroke-width: 0.9;
}

.miniField.league-goat .miniTurf {
  fill: rgba(201, 154, 30, 0.3);
}

.ranksPinned {
  margin: 0 0 8px;
  padding-left: 0;
  padding-top: 6px;
  border-top: 2px solid var(--marker);
  list-style: none;
}

.ranksPinned[hidden] {
  display: none;
}

.ranksPinned .rankRow {
  margin: 0;
}

.ranksCard > #ranksDoneButton {
  flex: 0 0 auto;
}

.ranksOverlay {
  grid-template-rows: minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
}

/* Profile: your league, yard line and how far to the end zone. */
.profileDrive {
  margin: 10px 0 4px;
  padding: 8px 10px;
  border: 2px solid var(--marker);
  border-radius: 6px 10px 7px 9px;
  background: rgba(46, 125, 79, 0.08);
}

.profileDriveTop {
  display: flex;
  justify-content: space-between;
  margin: 0 0 4px;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 17px;
}

.driveBar {
  position: relative;
  max-width: 340px;
  aspect-ratio: 4 / 1;
  margin: 0 auto;
}

.driveBar .miniField {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.driveBarFill {
  position: absolute;
  top: 18.75%;
  bottom: 18.75%;
  left: 4.69%;
  background: repeating-linear-gradient(-45deg, rgba(47, 95, 181, 0.28) 0 3px, transparent 3px 7px);
}

.profileDriveNote {
  margin: 4px 0 0;
}

/* STOREFRONT: the STORE tab shows the goods themselves, top to bottom. */
.storefront {
  padding-bottom: 28px;
}

.storeShelf {
  margin: 14px 0 0;
}

.storeShelfTitle {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 8px;
  margin: 0 0 6px;
  padding-bottom: 2px;
  border-bottom: 2px solid rgba(38, 35, 31, 0.75);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 17px;
  font-weight: normal;
}

.storeTimer {
  font-family: "Paper Hand", cursive;
  font-size: 14px;
  opacity: 0.75;
}

.menuCard .linkButton {
  width: auto;
  margin: 0;
  min-height: 32px;
  padding: 2px 6px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--pen-blue);
  font-family: "Paper Hand", cursive;
  font-size: 16px;
  text-decoration: underline;
  text-decoration-style: wavy;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.menuCard .storeMore,
.menuCard .storeWhole {
  display: block;
  margin: 6px auto 0;
}

.menuCard .storeWhole {
  margin-top: 16px;
}

/* A hand written price sticker: a little tag with a punched hole, stuck on a bit crooked. */
.menuCard .priceSticker {
  width: auto;
  margin: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 58px;
  min-height: 34px;
  padding: 3px 10px 3px 16px;
  border: 2px solid var(--marker);
  border-radius: 10px 4px 4px 10px;
  background: #fffdf4;
  box-shadow: 2px 3px 0 rgba(38, 35, 31, 0.22);
  color: var(--pen-red);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 15px;
  line-height: 1;
  white-space: nowrap;
  transform: rotate(var(--tilt, -3deg));
  touch-action: manipulation;
}

.priceSticker::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 5px;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border: 1.5px solid var(--marker);
  border-radius: 50%;
  background: #f3ead6;
}

.priceSticker.ink {
  color: #3b2a7a;
}

.priceSticker.money {
  color: var(--pen-blue);
  letter-spacing: -0.02em;
}

.priceSticker.owned {
  color: #2e7d4f;
}

.menuCard .priceSticker.big {
  min-height: 42px;
  padding-left: 20px;
  font-size: 20px;
}

.menuCard .priceSticker.armed {
  background: #ffe066;
  color: var(--marker);
}

.priceSticker:disabled {
  opacity: 0.55;
  filter: grayscale(0.6);
}

.priceSticker .coinDoodle {
  width: 15px;
  height: 15px;
}

/* FEATURED: the best pack you can buy, big, in foil. */
.storeFeatured {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin: 6px 0 0;
  padding: 18px 10px 10px;
  border: 2.5px solid var(--marker);
  border-radius: 6px 12px 8px 10px;
  background:
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0) 0 14px, rgba(255, 236, 160, 0.45) 14px 18px),
    linear-gradient(160deg, #fff6d6, #f6dc8a);
  box-shadow: 4px 5px 0 rgba(38, 35, 31, 0.2);
}

.storeKicker {
  position: absolute;
  top: -11px;
  left: 12px;
  padding: 1px 12px;
  background: var(--tape);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 14px;
  letter-spacing: 0.05em;
  transform: rotate(-2deg);
}

.menuCard .storeFoil {
  width: auto;
  min-height: 0;
  margin: 0;
  border-radius: 0;
  position: relative;
  display: block;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  box-shadow: none;
  transform: rotate(-4deg);
  filter: drop-shadow(3px 5px 0 rgba(38, 35, 31, 0.25));
}

.storeFoil canvas {
  display: block;
}

.foilSheen {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.65) 45%, rgba(255, 240, 180, 0.2) 52%, transparent 62%);
  background-size: 260% 100%;
  mix-blend-mode: screen;
  pointer-events: none;
  animation: foilSweep 2.6s ease-in-out infinite;
}

@keyframes foilSweep {
  from { background-position: 120% 0; }
  to { background-position: -40% 0; }
}

.storeFeaturedInfo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.storeFeaturedName {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: clamp(20px, 6vw, 26px);
  font-weight: normal;
  line-height: 1;
}

.storeFeaturedDetail {
  font-size: 14px;
  line-height: 1.15;
}

.storeFeaturedPrice {
  margin: 4px 0 0 2px;
}

.menuCard .storeFeaturedInfo .linkButton {
  min-height: 28px;
  padding-left: 0;
}

/* TODAY'S CARDS: 3 real cards with their price stickers. */
.storeDaily {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  min-height: 60px;
}

.storeCard {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.storeCardArt {
  display: block;
  max-width: 100%;
  height: auto !important;
  cursor: pointer;
  filter: drop-shadow(2px 3px 0 rgba(38, 35, 31, 0.22));
  touch-action: manipulation;
}

.storeCard.bought .storeCardArt {
  opacity: 0.55;
}

.storeCardTag {
  padding: 0 6px;
  background: var(--tape);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 11px;
  transform: rotate(-3deg);
}

.menuCard .storeCard .priceSticker {
  min-width: 0;
  padding-right: 8px;
  font-size: 14px;
}

/* FEATURED LOOK: the cosmetic of the day, moving. */
.storeLookBox {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.storeLookStage {
  display: grid;
  place-items: center;
  width: 132px;
  height: 104px;
  border: 2px solid var(--marker);
  border-radius: 5px 9px 6px 8px;
  background: #fffaf0;
  box-shadow: 2px 3px 0 rgba(38, 35, 31, 0.18);
}

.storeLookStage.emoteStage svg {
  width: 86px;
  height: 86px;
}

.storeLookInfo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.storeLookKind {
  font-size: 12px;
  letter-spacing: 0.06em;
  opacity: 0.7;
}

.storeLookName {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 19px;
  font-weight: normal;
  line-height: 1.05;
}

.storeLookInfo .priceSticker {
  margin-top: 4px;
}

/* INK bottles that grow with the bundle, and COIN piles. */
.storeInk,
.storeCoins {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  align-items: end;
}

.storeCoins {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.storeBottle,
.storePile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 0;
  padding-top: 14px;
}

.storeBottleArt .inkBottle {
  width: var(--size, 32px);
  height: auto;
  filter: drop-shadow(2px 3px 0 rgba(38, 35, 31, 0.2));
}

.storeBottle strong,
.storePile strong {
  margin-top: 2px;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 16px;
  font-weight: normal;
  line-height: 1;
}

.storeUnit {
  margin-bottom: 6px;
  font-size: 12px;
  opacity: 0.7;
}

.menuCard .storeBottle .priceSticker,
.menuCard .storePile .priceSticker {
  min-width: 0;
  max-width: 100%;
  padding: 3px 5px 3px 17px;
  font-size: 13px;
}

.storeBadge {
  position: absolute;
  top: 0;
  padding: 0 4px;
  background: #ffe066;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 9px;
  font-style: normal;
  white-space: nowrap;
  transform: rotate(-4deg);
}

.coinPile {
  width: 64px;
  height: 42px;
}

.coinPile .coinEdge {
  fill: #b7871a;
  stroke: var(--marker);
  stroke-width: 1.1;
}

.coinPile .coinFace {
  fill: #f3cf63;
  stroke: var(--marker);
  stroke-width: 1.1;
}

.coinPile .coinMark {
  stroke: #b7871a;
  stroke-width: 1.2;
  stroke-linecap: round;
}

/* The PLAYBOOK PASS banner, and the starter bundle note at the top while it's live. */
.menuCard .storePass,
.menuCard .storeStarter {
  min-height: 0;
  position: relative;
  display: grid;
  width: 100%;
  margin: 16px 0 0;
  padding: 10px 92px 10px 12px;
  border: 2.5px solid var(--marker);
  border-radius: 8px 4px 10px 6px;
  background: linear-gradient(135deg, #5b3fa6, #3b2a7a);
  box-shadow: 4px 5px 0 rgba(38, 35, 31, 0.24);
  color: #fffaf0;
  text-align: left;
}

.storePass b,
.storeStarter b {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 19px;
  font-weight: normal;
  color: #f3cf63;
}

.storePass span,
.storeStarter span {
  font-family: "Paper Hand", cursive;
  font-size: 15px;
  line-height: 1.15;
}

.storePass i {
  position: absolute;
  top: 50%;
  right: 10px;
  padding: 4px 8px;
  border: 2px solid var(--marker);
  border-radius: 6px;
  background: #f3cf63;
  color: var(--marker);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 14px;
  font-style: normal;
  transform: translateY(-50%) rotate(4deg);
}

.menuCard .storeStarter {
  margin: 0 0 10px;
  padding-right: 12px;
  background: linear-gradient(180deg, #fff3c9, var(--sticky) 72%, #efd98c);
  color: var(--marker);
  transform: rotate(-1deg);
}

.storeStarter b {
  color: var(--pen-red);
}

.storePass[hidden],
.storeStarter[hidden],
.storeShelf[hidden] {
  display: none;
}

.storeToast {
  position: sticky;
  bottom: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .foilSheen {
    animation: none;
    background-position: 40% 0;
  }
}

.menuCard .storePass:active,
.menuCard .priceSticker:active {
  transform: translateY(2px) rotate(var(--tilt, 0deg));
}

.binderPage .storeFeaturedDetail,
.binderPage .storeShelfTitle {
  text-align: left;
}

/* EMOTES: big die cut doodle stickers. The button only shows at the big moments, with a bounce. */
#emoteButton.locked {
  visibility: hidden;
  pointer-events: none;
}

#emoteButton.unlocked {
  animation: emoteUnlock 0.7s cubic-bezier(0.3, 1.6, 0.5, 1);
}

@keyframes emoteUnlock {
  0% { transform: scale(0.2) rotate(-20deg); }
  45% { transform: scale(1.35) rotate(8deg); }
  70% { transform: scale(0.92) rotate(-4deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.emoteArt .cheek {
  stroke: #e5735e;
  stroke-width: 2.4;
}

.emoteArt .tongue {
  fill: #e5735e;
  stroke-width: 2;
}

.emoteArt .letters {
  stroke: var(--pen-red);
  stroke-width: 2.4;
}

.emoteArt .puddle {
  stroke: #4a8fd8;
  stroke-width: 2.4;
}

.emoteArt .spark {
  stroke: #e0a21a;
  stroke-width: 2.6;
}

.emoteArt .bubble {
  fill: #dff0ff;
  stroke: #4a8fd8;
  stroke-width: 1.8;
}

.emoteArt .tapeBit {
  fill: rgba(226, 208, 150, 0.9);
  stroke: none;
}

.emoteArt .coin {
  fill: #f3cf63;
  stroke-width: 1.8;
}

/* The sticker itself: a white die cut edge around the doodle and a soft shadow, like it's stuck on. */
.emoteBubble .emoteArt,
.emoteChoice .emoteArt,
.storeLookStage .emoteArt,
.emoteThumb .emoteArt {
  overflow: visible;
  filter: drop-shadow(1.6px 0 0 #fff) drop-shadow(-1.6px 0 0 #fff) drop-shadow(0 1.6px 0 #fff) drop-shadow(0 -1.6px 0 #fff) drop-shadow(2px 3px 0 rgba(38, 35, 31, 0.28));
}

.emoteBubble {
  z-index: 12;
  width: 118px;
  height: 118px;
  padding: 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.emoteBubble::after {
  display: none;
}

.emoteBubble.mine {
  bottom: calc(var(--tray-h) + 48px);
}

.emoteBubble.theirs {
  top: calc(120px + var(--safe-top));
}

.emoteBubble.pop {
  animation: stickerSlap 0.42s cubic-bezier(0.25, 1.4, 0.5, 1), emoteFloat 2.6s ease-in-out;
}

@keyframes stickerSlap {
  0% { transform: scale(1.9) rotate(-18deg); opacity: 0; }
  55% { transform: scale(0.9) rotate(5deg); opacity: 1; }
  100% { transform: scale(1) rotate(-3deg); }
}

.emoteBubble.theirs.pop {
  transform: rotate(4deg);
}

.emoteChoices {
  grid-template-columns: repeat(4, 62px);
}

.emoteChoice {
  width: 62px;
  height: 62px;
  padding: 3px;
  border: 1.5px dashed rgba(38, 35, 31, 0.35);
  border-radius: 12px;
  background: #fffaf0;
}

/* Each sticker's own little animation: in the bubble, on the end screen, and in the store and locker. */
.emoteBubble.pop .emoteArt *,
.looping .emoteArt *,
.resultEmotes .emoteArt * {
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

.emoteBubble.pop .emote-laugh .bob,
.looping .emote-laugh .bob { animation: stickerShake 0.22s ease-in-out 6 alternate; }
.emoteBubble.pop .emote-laugh .letters,
.looping .emote-laugh .letters { animation: stickerPopIn 0.5s 0.2s both; }
.emoteBubble.pop .tear,
.looping .tear { animation: stickerDrip 0.9s ease-in infinite; }
.emoteBubble.pop .emote-cry .bob,
.looping .emote-cry .bob { animation: stickerSway 0.8s ease-in-out infinite alternate; }
.emoteBubble.pop .emote-thumbs .hand,
.looping .emote-thumbs .hand { transform-origin: 30% 90%; animation: stickerPump 0.5s ease-in-out 4 alternate; }
.emoteBubble.pop .spark,
.looping .spark { animation: stickerTwinkle 0.6s ease-in-out infinite alternate; }
.emoteBubble.pop .emote-angry .bob,
.looping .emote-angry .bob { animation: stickerRattle 0.09s linear 14 alternate; }
.emoteBubble.pop .steam,
.looping .steam { animation: stickerSteam 0.8s ease-out infinite; }
.emoteBubble.pop .emote-shades .drop,
.looping .emote-shades .drop { animation: stickerDrop 0.6s cubic-bezier(0.3, 1.5, 0.5, 1) both; }
.emoteBubble.pop .glint,
.looping .glint { animation: stickerTwinkle 0.4s 0.5s ease-in-out infinite alternate; }
.emoteBubble.pop .boom,
.looping .boom { animation: stickerBoom 0.7s ease-out infinite; }
.emoteBubble.pop .emote-mindblown .bob,
.looping .emote-mindblown .bob { animation: stickerShake 0.12s linear 8 alternate; }
.emoteBubble.pop .zz,
.looping .zz { animation: stickerFloatUp 1.4s ease-out infinite; }
.emoteBubble.pop .zz.small,
.looping .zz.small { animation-delay: 0.5s; }
.emoteBubble.pop .emote-sleepy .bubble,
.looping .emote-sleepy .bubble { animation: stickerBreathe 1.2s ease-in-out infinite alternate; }
.emoteBubble.pop .beat,
.looping .beat { animation: emoteBeat 0.6s ease-in-out infinite; }
.emoteBubble.pop .wobble,
.looping .wobble { animation: stickerSway 0.35s ease-in-out infinite alternate; }
.emoteBubble.pop .emote-salute .hand,
.looping .emote-salute .hand { transform-origin: 10% 90%; animation: stickerSalute 0.9s ease-out both; }
.emoteBubble.pop .emote-money .bob,
.looping .emote-money .bob { animation: stickerHop 0.4s ease-out 5 alternate; }
.emoteBubble.pop .coin,
.looping .coin { animation: stickerHop 0.3s 0.1s ease-out infinite alternate; }

/* On the end screen they idle a little so they read as tappable. */
.resultEmotes .emoteChoice .emoteArt { animation: stickerSway 1.6s ease-in-out infinite alternate; }
.resultEmotes .emoteChoice:nth-child(2n) .emoteArt { animation-delay: -0.8s; }

@keyframes stickerShake { from { transform: rotate(-7deg); } to { transform: rotate(7deg); } }
@keyframes stickerRattle { from { transform: translateX(-2px); } to { transform: translateX(2px); } }
@keyframes stickerSway { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }
@keyframes stickerPump { from { transform: translateY(0) rotate(0deg); } to { transform: translateY(-4px) rotate(-10deg); } }
@keyframes stickerHop { from { transform: translateY(0); } to { transform: translateY(-5px); } }
@keyframes stickerBreathe { from { transform: scale(0.6); } to { transform: scale(1.15); } }
@keyframes stickerDrip {
  0% { transform: translateY(-3px); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translateY(6px); opacity: 0; }
}
@keyframes stickerSteam {
  0% { transform: translateY(4px) scale(0.6); opacity: 0; }
  40% { opacity: 1; }
  100% { transform: translateY(-6px) scale(1.2); opacity: 0; }
}
@keyframes stickerFloatUp {
  0% { transform: translate(-4px, 6px); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translate(3px, -6px); opacity: 0; }
}
@keyframes stickerBoom {
  0% { transform: scale(0.3); opacity: 0; }
  40% { opacity: 1; }
  100% { transform: scale(1.3); opacity: 0; }
}
@keyframes stickerTwinkle { from { opacity: 0.25; } to { opacity: 1; } }
@keyframes stickerPopIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes stickerDrop {
  from { transform: translateY(-24px) rotate(-10deg); opacity: 0; }
  to { transform: translateY(0) rotate(0deg); opacity: 1; }
}
@keyframes stickerSalute {
  0% { transform: rotate(40deg); opacity: 0; }
  40% { transform: rotate(-8deg); opacity: 1; }
  100% { transform: rotate(0deg); }
}

/* The end of match screen: your stickers in a row, bouncing in. */
.resultEmotes {
  margin: 6px 0 2px;
}

.resultEmotes[hidden] {
  display: none;
}

.resultEmotes.unlocked {
  animation: emoteUnlock 0.7s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.resultEmotes.cooling .resultEmoteChoices {
  opacity: 0.45;
}

.resultEmoteChoices {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.menuCard .resultEmote {
  width: 52px;
  min-height: 0;
  height: 52px;
  margin: 0;
  padding: 2px;
  border: 1.5px dashed rgba(38, 35, 31, 0.35);
  border-radius: 12px;
  background: #fffaf0;
}

.resultEmote svg {
  width: 100%;
  height: 100%;
}

.menuCard .resultEmoteMute {
  width: auto;
  min-height: 30px;
  margin: 4px auto 0;
  padding: 2px 10px;
  border: 1.5px dashed rgba(38, 35, 31, 0.5);
  background: transparent;
  font-size: 12px;
}

@media (prefers-reduced-motion: reduce) {
  #emoteButton.unlocked,
  .resultEmotes.unlocked,
  .emoteBubble.pop,
  .emoteBubble.pop .emoteArt *,
  .looping .emoteArt *,
  .resultEmotes .emoteArt {
    animation: none !important;
  }
}

/* ---------- HEADER AND FRIENDS ---------- */
/* The top bar: logo and the wallet pills on top, your avatar chip and the doodle icons under them. */
.binderCard .binderTop {
  display: grid;
  gap: 4px;
  padding: 6px 8px 6px 12px;
}

.topRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.binderCard .binderLogo {
  flex: 1 1 auto;
  min-width: 0;
  overflow: visible;
  padding: 0;
}

/* The hand lettered logo, consistent with the app icon: tan football, blue O, red X, yellow highlighter. */
.logoArt {
  display: block;
  width: clamp(150px, 46vw, 205px);
  height: auto;
  overflow: visible;
}

.logoArt text {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 34px;
}

.logoShadow {
  fill: rgba(38, 35, 31, 0.32);
  stroke: rgba(38, 35, 31, 0.32);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.logoOutline {
  fill: none;
  stroke: var(--marker);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.logoFill {
  fill: #2f5fb5;
}

.logoShine {
  fill: none;
  stroke: #cfe0ff;
  stroke-width: 2.4;
  stroke-linecap: round;
}

.logoSwipe {
  fill: none;
  stroke: #f6d640;
  stroke-width: 13;
  stroke-linecap: round;
  opacity: 0.75;
}

.logoBallBody {
  fill: #c9b48b;
  stroke: #565149;
  stroke-width: 2.6;
}

.logoLaces,
.logoMotion,
.logoBallShine {
  fill: none;
  stroke: #565149;
  stroke-width: 2.2;
  stroke-linecap: round;
}

.logoBallShine {
  stroke: #efe3c6;
  stroke-width: 1.8;
}

.logoMotion {
  stroke-width: 1.8;
  opacity: 0.8;
}

.logoX {
  fill: none;
  stroke: #c0392b;
  stroke-width: 2.8;
  stroke-linecap: round;
}

.logoO {
  fill: none;
  stroke: #2f5fb5;
  stroke-width: 2.6;
}

/* Coins and ink: clear pills with big icons and a + that goes to the store. */
.binderCard .walletPills {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  margin: 0;
}

.binderCard .walletPill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: auto;
  min-width: 0;
  min-height: 32px;
  margin: 0;
  padding: 1px 2px 1px 3px;
  border: 2px solid var(--marker);
  border-radius: 999px;
  background: #fffdf6;
  box-shadow: 2px 2px 0 rgba(86, 81, 73, 0.22);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 15px;
  line-height: 1;
}

.walletIcon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 25px;
  height: 25px;
}

.walletIcon svg {
  width: 25px;
  height: 25px;
}

.coinIcon .coinEdge {
  fill: #b7871a;
  stroke: var(--marker);
  stroke-width: 1.6;
}

.coinIcon .coinFace {
  fill: #f3cf63;
  stroke: var(--marker);
  stroke-width: 1.6;
}

.coinIcon .coinRim {
  fill: none;
  stroke: #c99a1e;
  stroke-width: 1.2;
}

.coinIcon .coinMark {
  fill: none;
  stroke: #8a6410;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.inkIcon .inkBottle {
  width: 21px;
  height: 25px;
}

.walletValue {
  flex: 1 1 auto;
  min-width: 0;
  text-align: right;
}

.binderCard .walletPill .inkStat {
  font-size: inherit;
}

.walletPlus {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--pen-blue);
  color: #fffaf0;
  font-size: 17px;
}

.inkPill .walletPlus {
  background: #5b3fa6;
}

/* Your avatar chip: card portrait, @username, league badge. */
.binderCard .avatarButton {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  max-width: 190px;
  min-height: 40px;
  margin: 0;
  padding: 2px 8px 2px 2px;
  border: 2px solid var(--marker);
  border-radius: 999px;
  background: #fffdf6;
  box-shadow: 2px 2px 0 rgba(86, 81, 73, 0.2);
  text-align: left;
}

.avatarFace {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
}

.avatarFace canvas {
  display: block;
}

.avatarFace .onlineDot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  margin: 0;
  border: 2px solid #fffdf6;
}

.avatarText {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
  line-height: 1.05;
}

.avatarName {
  max-width: 100%;
  overflow: hidden;
  font-family: "Paper Hand", cursive;
  font-size: 16px;
  font-weight: normal;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.binderCard .avatarButton .menuName {
  margin: 0;
  color: var(--marker);
}

.leagueBadge {
  display: inline-block;
  padding: 0 5px;
  border: 1.5px solid var(--marker);
  border-radius: 3px 6px 3px 6px;
  background: #e9e1cc;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 9px;
  letter-spacing: 0.04em;
  line-height: 1.5;
  color: var(--marker);
}

.leagueBadge.league-backyard { background: #f3e7c9; }
.leagueBadge.league-recess { background: #d6ecff; }
.leagueBadge.league-middle { background: #dcf3d2; }
.leagueBadge.league-varsity { background: #3d4a43; color: #fffaf0; }
.leagueBadge.league-college { background: #fff2a8; }
.leagueBadge.league-pros { background: #cfe0ff; }
.leagueBadge.league-goat { background: linear-gradient(135deg, #f7dc7a, #c99a1e); }

.avatarChip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.avatarChip.stacked {
  flex-direction: column;
  gap: 2px;
  text-align: center;
}

.avatarChip.stacked .avatarText {
  align-items: center;
}

/* The install hint: a small sticky note with an X. Gone for good after NOT NOW, the X or installing. */
.binderCard .installNote {
  position: relative;
  margin: 0 56px 6px 10px;
  padding: 6px 30px 6px 10px;
  border: 0;
  border-radius: 2px 2px 10px 2px;
  background: linear-gradient(180deg, #fff3c9, var(--sticky) 72%, #efd98c);
  box-shadow: 2px 3px 0 rgba(38, 35, 31, 0.2);
  text-align: left;
  transform: rotate(-1deg);
}

.binderCard .installNote p {
  margin: 0 0 4px;
  font-size: 14px;
}

.binderCard .installNote .installHintButtons {
  justify-content: flex-start;
}

.binderCard .installNote .smallButton {
  min-height: 30px;
  padding: 2px 10px;
  font-size: 13px;
}

.binderCard .installClose {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 28px;
  min-height: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 22px;
  line-height: 1;
}

/* FRIENDS ONLINE: a taped strip under PLAY with a chip for each friend who's on. */
.friendsOnline {
  position: relative;
  margin: 2px 0 8px;
  padding: 6px 8px 6px;
  border: 2px dashed rgba(38, 35, 31, 0.45);
  border-radius: 6px 10px 6px 9px;
  background: rgba(214, 236, 255, 0.45);
}

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

.friendsOnlineTitle {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 13px;
  letter-spacing: 0.04em;
}

.friendsOnlineTitle::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 50%;
  background: #2e9e57;
  vertical-align: 1px;
}

.binderCard .friendsOnline .linkButton {
  min-height: 26px;
  padding: 0 2px;
  font-size: 14px;
}

.friendsOnlineList {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 2px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.friendsOnlineList:empty {
  display: none;
}

.binderCard .onlineFriend {
  flex: 0 0 auto;
  width: 66px;
  min-height: 0;
  margin: 0;
  padding: 2px 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.onlineFriend .avatarName {
  max-width: 64px;
  font-size: 12px;
}

.onlineFriend .leagueBadge {
  font-size: 8px;
}

.friendsOnline .friendsOnlineEmpty {
  margin: 2px 0 0;
  font-size: 13px;
  text-align: left;
}

.friendsOnlineEmpty[hidden] {
  display: none;
}

/* The challenge sheet for one friend. */
.friendSheet[hidden] {
  display: none !important;
}

.friendSheet {
  z-index: 13;
}

.friendSheetCard {
  width: min(360px, 100%);
}

.friendSheetWho {
  display: flex;
  justify-content: center;
  margin: 4px 0 8px;
}

.friendSheetWho .avatarName {
  font-size: 20px;
}

.menuCard .friendSheetPlay {
  min-height: 60px;
  background: var(--pen-blue);
  color: #fffaf0;
  font-size: 26px;
}

.menuCard .friendSheetCaptains {
  background: linear-gradient(180deg, #ffe7c2, #f7c479);
}

/* The friend toast: a little sticky note that drops in near the top. */
.crewToast[hidden],
.inviteFloat[hidden] {
  display: none !important;
}

.crewToast {
  position: absolute;
  top: calc(10px + var(--safe-top));
  left: 50%;
  z-index: 14;
  width: min(330px, calc(100% - 32px));
  padding: 10px 12px;
  border: 2px solid var(--marker);
  border-radius: 3px 3px 12px 3px;
  background: linear-gradient(180deg, #fff3c9, var(--sticky) 72%, #efd98c);
  box-shadow: 3px 4px 0 rgba(38, 35, 31, 0.24);
  color: var(--marker);
  font-family: "Paper Hand", cursive;
  font-size: 16px;
  text-align: left;
  transform: translateX(-50%) rotate(-1deg);
}

.crewToast.pop {
  animation: toastDrop 0.4s cubic-bezier(0.3, 1.5, 0.5, 1);
}

@keyframes toastDrop {
  from { transform: translate(-50%, -30px) rotate(-6deg); opacity: 0; }
  to { transform: translateX(-50%) rotate(-1deg); opacity: 1; }
}

/* A challenge during a CPU match: a banner over the field. */
.inviteFloat {
  position: absolute;
  top: calc(64px + var(--safe-top));
  left: 50%;
  z-index: 14;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: min(360px, calc(100% - 24px));
  padding: 8px 10px;
  border: 2px solid var(--marker);
  border-radius: 6px 10px 6px 10px;
  background: #fffdf6;
  box-shadow: 3px 4px 0 rgba(38, 35, 31, 0.24);
  font-family: "Paper Hand", cursive;
  font-size: 16px;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: auto;
}

.inviteFloat span {
  flex: 1 1 100%;
}

/* Pick a username: the @ sits in the box. */
.usernameField {
  display: flex;
  align-items: center;
  margin: 8px 0 2px;
  border: 2px solid var(--marker);
  border-radius: 4px 10px 6px 8px;
  background: #fffdf6;
}

.usernameAt {
  padding: 0 2px 0 12px;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 22px;
  color: var(--pen-blue);
}

.menuCard .usernameField input {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding-left: 2px;
  border: 0;
  background: transparent;
  font-size: 20px;
}

.usernameNote {
  min-height: 1.3em;
}

.usernameNote.good {
  color: #2e7d4f;
}

.usernameNote.bad {
  color: var(--pen-red);
}

.menuCard .usernameSuggest {
  min-height: 0;
  padding: 0 2px;
  font-size: inherit;
}

.menuCard .usernameRule {
  margin: 2px 0 0;
  font-size: 13px;
  opacity: 0.75;
}

/* Avatars in lists. */
.friendName.avatarChip {
  gap: 8px;
}

.squadMember .avatarFace {
  margin-right: 6px;
}

.rankFace canvas {
  display: block;
}

/* Profile: your avatar, tap to change. */
.menuCard .profileAvatar {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 96px;
  min-height: 0;
  margin: 0;
  padding: 2px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.profileAvatarChange {
  margin-top: -8px;
  padding: 0 6px;
  border: 1.5px solid var(--marker);
  border-radius: 4px;
  background: #fff6c8;
  font-size: 11px;
}

.avatarPicker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0;
}

.avatarPicker[hidden] {
  display: none;
}

.avatarPicker .fieldLabel {
  flex: 1 1 100%;
  margin: 0;
}

.menuCard .avatarOption {
  width: 54px;
  min-height: 0;
  height: 54px;
  margin: 0;
  padding: 1px;
  border: 2px solid transparent;
  border-radius: 50%;
  background: transparent;
}

.menuCard .avatarOption.on {
  border-color: var(--pen-blue);
  background: #e9f0fb;
}

.binderCard .binderTop .binderIcons {
  align-self: flex-start;
}

.binderCard .binderTop .doodleIcon {
  width: 36px;
  height: 36px;
}

.menuCard .usernameField input {
  text-align: left;
}

/* Nobody on: the strip is one short line. */
.friendsOnline:not(.hasFriends) {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 8px;
  padding: 3px 8px;
}

.friendsOnline:not(.hasFriends) .friendsOnlineHead {
  display: contents;
}

.friendsOnline:not(.hasFriends) #friendsOnlineAll {
  display: none;
}

@media (max-width: 390px) {
  .binderCard .avatarButton .avatarName {
    font-size: 14px;
  }

  .binderCard .walletPill {
    gap: 2px;
  }
}

/* ---------- USERNAME CASE ---------- */
/* Every @username in the handwriting font (Patrick Hand has real lower case; the marker font is all capitals),
   exactly as typed: never upper cased, even inside a marker heading, a marker button or an all caps line. A touch
   bigger than the text around it so it still reads clearly next to the marker. */
.username,
.menuCard .username,
.binderCard .username,
.bracketSvg text.username {
  font-family: "Paper Hand", "Comic Sans MS", cursive !important;
  font-style: normal;
  font-weight: normal;
  letter-spacing: 0;
  text-transform: none !important;
}

/* Inside marker headings and lines (lobby title, profile, the friend match record, Captains), size it up so it
   holds its own next to the marker capitals. */
h1 .username,
h2.username,
.resultRecord .username,
.draftName.username {
  font-size: 1.12em;
}

.profileName.username {
  font-size: 30px;
  line-height: 1.05;
}

.squadMemberName.username,
.rankName.username,
.avatarName.username {
  font-size: 17px;
}

.binderCard .avatarButton .avatarName.username {
  font-size: 17px;
}

.onlineFriend .avatarName.username {
  font-size: 13px;
}

.bracketSvg text.username {
  font-size: 14px;
}

@media (max-width: 390px) {
  .binderCard .avatarButton .avatarName.username {
    font-size: 15px;
  }
}

/* ---------- DECK SCREEN ---------- */
/* MY DECK as a binder page: ruled paper, the deck in a clear plastic sleeve, the shoebox under it. */
.deckOverlay {
  padding-top: calc(10px + var(--safe-top));
  overflow-x: hidden;
}

.menuCard.deckBinder {
  width: min(560px, 100%);
  padding: 10px 10px 14px 24px;
  border-radius: 6px 10px 8px 6px;
  background-color: #fffaf0;
  background-image:
    linear-gradient(90deg, transparent 15px, rgba(192, 57, 43, 0.45) 15px 16.5px, transparent 16.5px),
    repeating-linear-gradient(180deg, transparent 0 25px, rgba(47, 95, 181, 0.13) 25px 26px);
  text-align: left;
}

.deckTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.menuCard .deckTitle {
  margin: 0;
  font-size: clamp(24px, 7vw, 30px);
  text-align: left;
  transform: rotate(-1.5deg);
}

.menuCard .deckTop #deckDoneButton {
  width: auto;
  min-height: 38px;
  margin: 0;
  padding: 2px 16px;
  font-size: 16px;
}

/* DECK 1 to DECK 5: sticky note tabs. The one in use sits forward and says IN USE. */
.deckSlotTabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  margin: 8px 0 14px;
}

.menuCard .deckSlotTab {
  position: relative;
  min-height: 34px;
  margin: 0;
  padding: 2px 0 0;
  border: 1.5px solid rgba(38, 35, 31, 0.55);
  border-radius: 2px 2px 7px 2px;
  background: linear-gradient(180deg, #fff6d0, #fbe7a0);
  box-shadow: 1px 2px 0 rgba(38, 35, 31, 0.16);
  font-size: clamp(11px, 3.2vw, 14px);
  opacity: 0.78;
  transform: rotate(var(--tilt, 0deg)) translateY(3px);
}

.menuCard .deckSlotTab:nth-child(2) { background: linear-gradient(180deg, #e3f1ff, #c6e0fb); }
.menuCard .deckSlotTab:nth-child(3) { background: linear-gradient(180deg, #ffe4ec, #fbc9d8); }
.menuCard .deckSlotTab:nth-child(4) { background: linear-gradient(180deg, #e2f6dd, #c4ebbd); }
.menuCard .deckSlotTab:nth-child(5) { background: linear-gradient(180deg, #efe4ff, #d9c7fb); }

.menuCard .deckSlotTab.active {
  border: 2px solid var(--marker);
  opacity: 1;
  transform: rotate(var(--tilt, 0deg)) translateY(-2px) scale(1.06);
  box-shadow: 2px 4px 0 rgba(38, 35, 31, 0.24);
}

.deckSlotTab.active::after {
  content: "IN USE";
  position: absolute;
  bottom: -13px;
  line-height: 12px;
  white-space: nowrap;
  left: 50%;
  padding: 0 4px;
  background: var(--marker);
  color: #fff6c8;
  font-size: 8px;
  letter-spacing: 0.05em;
  transform: translateX(-50%) rotate(-2deg);
}

.deckSlotTab.fresh::after {
  content: "NEW";
  position: absolute;
  top: -6px;
  right: -2px;
  padding: 0 3px;
  border-radius: 3px;
  background: #fffdf6;
  border: 1px solid rgba(38, 35, 31, 0.5);
  font-size: 8px;
  transform: rotate(8deg);
}

/* The ink drop and the balance bar, side by side. */
.deckStats {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin: 12px 0 4px;
}

.inkMeter {
  display: flex;
  align-items: center;
  gap: 4px;
}

.inkMeter svg {
  width: 30px;
  height: 42px;
}

.inkDropBack {
  fill: #fffdf6;
}

.inkDropFill {
  fill: #2f4fb0;
}

.inkDropLine {
  fill: none;
  stroke: var(--marker);
  stroke-width: 2.2;
  stroke-linejoin: round;
}

.inkDropShine {
  fill: none;
  stroke: rgba(255, 255, 255, 0.7);
  stroke-width: 2;
  stroke-linecap: round;
}

.inkMeterText {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.inkMeterText b {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 22px;
  font-weight: normal;
  color: #2f4fb0;
}

.inkMeterText small {
  font-size: 10px;
  letter-spacing: 0.04em;
}

.balanceTrack {
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 2px;
  height: 18px;
  padding: 2px;
  border: 2px solid var(--marker);
  border-radius: 4px 7px 4px 6px;
  background: #fffdf6;
}

.balanceCell {
  border-radius: 2px;
}

.balanceCell.offense {
  background: repeating-linear-gradient(-45deg, #5b93d4 0 3px, #2f5fb5 3px 5px);
}

.balanceCell.defense {
  background: repeating-linear-gradient(-45deg, #e07a6d 0 3px, #c0392b 3px 5px);
}

.balanceCell.either {
  background: repeating-linear-gradient(-45deg, #f3cf63 0 3px, #c99a1e 3px 5px);
}

/* The 2 and 2 minimum: marker ticks 2 cells in from each end. */
.balanceMin {
  position: absolute;
  top: -5px;
  bottom: -5px;
  width: 0;
  border-left: 2.5px solid var(--marker);
  transform: translateX(-1px) rotate(3deg);
}

.balanceLabels {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin-top: 3px;
  font-size: 12px;
  line-height: 1;
}

.balanceOffense { color: var(--pen-blue); }
.balanceDefense { color: var(--pen-red); }
.balanceRule { opacity: 0.65; }

.balanceLabels .short {
  padding: 0 3px;
  background: #ffe066;
  font-weight: bold;
}

/* The deck sleeve: a clear plastic page with 8 pockets, 4 by 2, like the sleeve on the PLAY page. */
.deckSleeve {
  position: relative;
  margin: 8px -4px 0;
  padding: 6px 5px 8px;
  border: 2px solid rgba(38, 35, 31, 0.55);
  border-radius: 5px 5px 6px 4px;
  background: linear-gradient(118deg, rgba(255, 255, 255, 0.55) 0 14%, rgba(214, 228, 244, 0.28) 14% 37%, rgba(255, 255, 255, 0.5) 37% 41%, rgba(210, 224, 242, 0.3) 41% 100%);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.5), 2px 3px 0 rgba(86, 81, 73, 0.16);
}

.deckSleeve::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(125deg, transparent 0 22%, rgba(255, 255, 255, 0.24) 24% 27%, transparent 29% 62%, rgba(255, 255, 255, 0.18) 64% 66%, transparent 68%);
  pointer-events: none;
}

#deckSlots.deckPockets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.deckSleeveSlot,
.looseCard {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
}

.deckSleeveSlot {
  padding: 3px 3px 4px;
  border: 1.5px solid rgba(110, 135, 170, 0.55);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.deckPockets button,
.shoeboxCards button {
  position: relative;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

.deckPockets canvas,
.shoeboxCards canvas {
  display: block;
  margin: 0 auto;
  filter: drop-shadow(2px 3px 0 rgba(86, 81, 73, 0.2));
}

/* Ready to level up: the sleeve glows softly and a pencil arrow bounces on the card. */
.deckSleeveSlot.ready,
.looseCard.ready {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35), 0 0 0 2px rgba(79, 166, 90, 0.55), 0 0 12px 3px rgba(120, 210, 120, 0.55);
  animation: sleeveGlow 1.8s ease-in-out infinite;
}

@keyframes sleeveGlow {
  50% { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35), 0 0 0 2px rgba(79, 166, 90, 0.8), 0 0 18px 6px rgba(120, 210, 120, 0.7); }
}

.upArrow {
  position: absolute;
  top: 30%;
  left: 5%;
  width: 24%;
  max-width: 26px;
  pointer-events: none;
  animation: arrowBounce 0.9s ease-in-out infinite;
}

.upArrowFill { fill: #6cc46f; }
.upArrowLine { fill: none; stroke: var(--marker); stroke-width: 2.4; stroke-linejoin: round; }

@keyframes arrowBounce {
  0%, 100% { transform: translateY(2px); }
  50% { transform: translateY(-5px); }
}

/* The chunky pencil progress bar under each card. */
.deckBinder .copyBar {
  height: 16px;
  margin: 4px 1px 0;
  border-width: 2px;
  border-radius: 4px 6px 3px 5px;
}

.deckBinder .copyBar .copyFill {
  background: repeating-linear-gradient(-50deg, #8a8a8a 0 2px, #5d5a55 2px 3.5px);
  opacity: 0.75;
}

.deckBinder .copyBar.ready .copyFill {
  background: repeating-linear-gradient(-50deg, #8ad08a 0 3px, #4fa65a 3px 5px);
  opacity: 1;
}

.deckBinder .copyBar em {
  font-size: 10px;
  line-height: 12px;
}

.deckBinder .levelStamp {
  position: absolute;
  top: 40%;
  left: 50%;
  padding: 1px 6px;
  border: 2px solid var(--pen-red);
  background: #fffdf6;
  color: var(--pen-red);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 12px;
  white-space: nowrap;
  transform: translateX(-50%) rotate(-8deg);
  animation: stampIn 0.4s ease-out;
}

.deckNote {
  margin: 8px 0 0 !important;
  padding: 6px 8px;
  border: 1.5px dashed rgba(38, 35, 31, 0.5);
  background: #fff6c8;
  font-size: 14px !important;
}

.deckNote[hidden] {
  display: none;
}

/* The SHOEBOX: loose cards in a cardboard box. */
.shoebox {
  position: relative;
  margin: 18px -4px 0;
  padding: 0 8px 10px;
  border: 2.5px solid #6b4a2a;
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background:
    repeating-linear-gradient(90deg, rgba(120, 82, 46, 0.06) 0 2px, transparent 2px 9px),
    linear-gradient(180deg, #d9b98d, #c9a273);
  box-shadow: inset 0 10px 14px -8px rgba(60, 38, 18, 0.55), 2px 4px 0 rgba(60, 38, 18, 0.2);
}

.shoeboxLid {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 -10px 10px;
  padding: 8px 12px 6px;
  border: 2.5px solid #6b4a2a;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #e8cfa8, #d8b88a);
  box-shadow: 0 3px 0 rgba(60, 38, 18, 0.25);
  transform: rotate(-0.6deg);
}

.menuCard .shoeboxLid h2 {
  margin: 0;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 22px;
  color: #4a2f16;
}

.shoeboxFound {
  padding: 1px 8px;
  background: rgba(255, 250, 240, 0.85);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 14px;
  transform: rotate(2deg);
}

.shoeboxSort {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 0 0 6px;
}

.shoeboxSort span {
  font-size: 13px;
  color: #4a2f16;
}

.menuCard .shoeboxSort button {
  width: auto;
  min-height: 30px;
  margin: 0;
  padding: 1px 10px;
  border: 1.5px solid rgba(38, 35, 31, 0.6);
  border-radius: 999px;
  background: #fffaf0;
  font-size: 13px;
}

.menuCard .shoeboxSort button.active {
  border-width: 2px;
  border-color: var(--marker);
  background: #ffe066;
}

.shoebox .deckTabs {
  margin: 0 0 8px;
}

.shoeboxCards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 6px;
}

.looseCard {
  transform: rotate(var(--tilt, 0deg));
}

.shoeboxCards .emptySwap {
  grid-column: 1 / -1;
}

.deckBinder .deckButtons {
  grid-template-columns: 1fr;
}

/* The BINDER tab's count of upgrades ready. */
.tabCount {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  padding: 0 4px;
  border: 1.5px solid var(--marker);
  border-radius: 999px;
  background: #6cc46f;
  color: var(--marker);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 11px;
  line-height: 15px;
  text-align: center;
}

.tabCount[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .upArrow,
  .deckSleeveSlot.ready,
  .looseCard.ready {
    animation: none;
  }
}

/* ---------- SNAP AND DEFENSE ---------- */

/* The floating thumbstick: a pencil ring where the thumb came down, the knob follows it. Never takes a touch. */
#defenseStick {
  position: fixed;
  z-index: 24;
  width: 92px;
  height: 92px;
  margin: -46px 0 0 -46px;
  border: 2.5px dashed rgba(38, 35, 31, 0.55);
  border-radius: 50% 47% 52% 49%;
  background: rgba(255, 250, 240, 0.28);
  pointer-events: none;
}

#defenseStick[hidden] {
  display: none;
}

#defenseStick .stickKnob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  border: 2.5px solid var(--marker);
  border-radius: 48% 52% 50% 50%;
  background: radial-gradient(circle at 38% 34%, #fffaf0, #dce9fb 70%);
  box-shadow: 2px 3px 0 rgba(86, 81, 73, 0.28);
  transform: translate(-50%, -50%);
}

#defenseStick.moved {
  border-style: solid;
  border-color: rgba(47, 95, 181, 0.6);
}

/* The fixed joystick: always in the bottom left corner during the play (your defender, or your ball carrier after
   a catch), so you always know where it is. input.js takes the touches; the ring itself never does. */
#fixedStick {
  position: absolute;
  left: calc(16px + var(--safe-left));
  bottom: calc(var(--tray-h) + 12px);
  z-index: 24;
  width: 96px;
  height: 96px;
  box-sizing: border-box;
  border: 2.5px solid rgba(38, 35, 31, 0.55);
  border-radius: 50% 47% 52% 49%;
  background: rgba(255, 250, 240, 0.55);
  box-shadow: 2px 3px 0 rgba(86, 81, 73, 0.18);
  pointer-events: none;
}

#fixedStick[hidden] {
  display: none;
}

#fixedStick .stickKnob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 42px;
  height: 42px;
  border: 2.5px solid var(--marker);
  border-radius: 48% 52% 50% 50%;
  background: radial-gradient(circle at 38% 34%, #fffaf0, #dce9fb 70%);
  box-shadow: 2px 3px 0 rgba(86, 81, 73, 0.28);
  transform: translate(-50%, -50%);
}

#fixedStick.carrier .stickKnob {
  background: radial-gradient(circle at 38% 34%, #fffaf0, #ffd9a8 70%);
}

#fixedStick.active {
  border-color: rgba(47, 95, 181, 0.75);
  background: rgba(255, 250, 240, 0.7);
}

/* TACKLE and SWAT: sticker buttons stacked above TURBO, on screen the whole play on defense. BUILD 10: always on
   the right (righty), 20% smaller than before, clear of the joystick in the other corner and of each other; LEFTY
   mirrors them (see the end of this section). Dimmed until the defender is in range, then lit with a pulse. Only
   opacity, filter and transform change, so nothing moves when one lights up. SWAT sits lower, TACKLE above it. */
.assistButton {
  --tilt: -4deg;
  position: absolute;
  bottom: calc(var(--tray-h) + 98px);
  width: 70px;
  height: 70px;
  padding: 0;
  border: 3px solid var(--marker);
  border-radius: 50% 46% 52% 48%;
  background: radial-gradient(circle at 40% 32%, #fff6dc, var(--sticky) 62%, #f2c95c);
  color: var(--marker);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 16px;
  letter-spacing: 0.5px;
  pointer-events: auto;
  touch-action: none;
  box-shadow: 1px 2px 0 rgba(86, 81, 73, 0.18);
  opacity: 0.42;
  filter: saturate(0.15);
  transform: rotate(var(--tilt));
  transition: opacity 90ms ease-out, filter 90ms ease-out, box-shadow 90ms ease-out;
}

#swatButton,
#arcadeSwat {
  --tilt: 4deg;
  background: radial-gradient(circle at 40% 32%, #f6fbff, #dce9fb 62%, #a9c4ef);
}

.assistButton.ready {
  opacity: 1;
  filter: none;
  box-shadow: 3px 5px 0 rgba(86, 81, 73, 0.3);
}

/* The lit button breathes: a marker ring pulses out from it. */
.assistButton.ready::after {
  content: "";
  position: absolute;
  inset: -7px;
  border: 3px solid rgba(216, 64, 46, 0.75);
  border-radius: inherit;
  pointer-events: none;
  animation: assistRing 700ms ease-out infinite;
}

/* Over TURBO's right edge (TURBO is 104 wide, these 70: centered over it). */
.assistButton {
  right: calc(35px + var(--safe-right));
}

/* TACKLE stacks above SWAT on the same edge, out of the middle of the field where a thumb starts the stick. */
#tackleButton {
  bottom: calc(var(--tray-h) + 178px);
}

/* BUILD 10 LEFTY: the joystick goes bottom right, TURBO, TACKLE and SWAT to the left (matches and arcade drills). */
[data-handed="lefty"] #fixedStick {
  left: auto;
  right: calc(16px + var(--safe-right));
}

[data-handed="lefty"] #turboButton {
  right: auto;
  left: calc(18px + var(--safe-left));
}

[data-handed="lefty"] .assistButton {
  right: auto;
  left: calc(35px + var(--safe-left));
}

.assistButton[hidden] {
  display: none;
}

.assistButton.pop {
  animation: assistPop 260ms cubic-bezier(.3, 1.6, .5, 1);
}

.assistButton.hit {
  animation: assistHit 180ms ease-out;
}

@keyframes assistPop {
  0% { transform: scale(0.8) rotate(var(--tilt)); }
  55% { transform: scale(1.14) rotate(var(--tilt)); }
  100% { transform: scale(1) rotate(var(--tilt)); }
}

@keyframes assistHit {
  0% { transform: scale(0.86) rotate(var(--tilt)); }
  100% { transform: scale(1) rotate(var(--tilt)); }
}

@keyframes assistRing {
  0% { transform: scale(0.94); opacity: 1; }
  100% { transform: scale(1.22); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .assistButton.pop,
  .assistButton.ready::after {
    animation: none;
  }
}

/* COACH'S CALL: a sticky note under the scoreboard for a moment, on the defense's phone. */
/* COACH'S CALL: laid over the scoreboard (above the field) for the first moments of the play, never over the
   field or a player. A tap puts it away. */
#coachCallNote {
  position: absolute;
  top: calc(max(30px, var(--safe-top) + 18px) - 24px);
  left: calc(4px + var(--safe-left));
  right: calc(4px + var(--safe-right));
  z-index: 30;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
  height: 66px;
  padding: 4px 14px;
  overflow: hidden;
  border: 2px solid var(--marker);
  border-radius: 3px 3px 12px 4px;
  background: var(--sticky);
  color: var(--marker);
  text-align: center;
  box-shadow: 2px 4px 0 rgba(86, 81, 73, 0.22);
  transform: rotate(-0.5deg);
  pointer-events: auto;
  cursor: pointer;
}

#coachCallNote[hidden] {
  display: none;
}

#coachCallNote::before {
  display: none;
}

#coachCallNote strong {
  display: block;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 19px;
  font-weight: 400;
  line-height: 1.1;
  white-space: nowrap;
}

#coachCallNote small {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  margin-top: 2px;
  font-family: "Paper Hand", cursive;
  font-size: 15px;
  line-height: 1.15;
}

#coachCallNote.show {
  animation: coachNoteIn 2600ms ease-out both;
}

@keyframes coachNoteIn {
  0% { opacity: 0; transform: translateY(-10px) rotate(-2deg); }
  10% { opacity: 1; transform: translateY(0) rotate(-0.5deg); }
  85% { opacity: 1; }
  100% { opacity: 0; }
}

.replaying #defenseStick,
.replaying #fixedStick,
.replaying .assistButton,
.replaying #coachCallNote {
  display: none;
}

/* ---------- ARCADE (BIG UPDATE part 2) ---------- */
.modeCard .bullFill {
  fill: #d8402e;
}

/* The tilted cards stick out a hair; never let that scroll the sheet sideways. */
#arcadeScreen {
  overflow-x: hidden;
}

.arcadeGames {
  display: grid;
  gap: 10px;
  margin: 10px 0 8px;
}

.arcadeGame {
  position: relative;
  display: grid;
  gap: 3px;
  padding: 9px 12px 9px;
  border: 1.5px solid rgba(38, 35, 31, 0.7);
  border-radius: 3px 4px 3px 12px;
  background: #fffaf0;
  box-shadow: 2px 3px 0 rgba(86, 81, 73, 0.2);
  text-align: left;
}

.arcadeGame:nth-child(odd) { transform: rotate(-0.5deg); }
.arcadeGame:nth-child(even) { transform: rotate(0.5deg); }

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

.arcadeGameName {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: clamp(17px, 5vw, 21px);
}

.arcadeControl {
  flex: 0 0 auto;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 11px;
  color: var(--pen-blue);
  letter-spacing: 0.04em;
}

.arcadeGameLine,
.arcadeToday {
  margin: 0;
  font-family: "Paper Hand", cursive;
  font-size: 14px;
  color: var(--graphite);
}

.arcadeToday {
  font-size: 13px;
  color: #2e7a45;
}

.arcadeGameFoot {
  display: flex;
  align-items: center;
  gap: 10px;
}

.arcadeGameBest {
  flex: 1 1 auto;
  white-space: nowrap;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 15px;
}

.menuCard .arcadePlayButton {
  min-height: 38px;
  margin: 0;
  padding: 4px 18px;
}

.arcadeRewardNote {
  text-align: left;
}

.arcadeBoard {
  position: absolute;
  inset: 12px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 2px solid var(--marker);
  border-radius: 6px 4px 8px 4px;
  background: #fffaf0;
  box-shadow: 3px 4px 0 rgba(86, 81, 73, 0.25);
}

.arcadeBoard[hidden] {
  display: none;
}

.arcadeBoardHead {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 8px;
}

.arcadeBoardHead b {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-weight: normal;
  font-size: 20px;
}

.arcadeBoardKicker {
  grid-row: 2;
  font-size: 12px;
  color: var(--graphite);
}

.arcadeBoardHead .smallButton {
  grid-row: 1 / span 2;
  grid-column: 2;
}

.arcadeBoardList {
  display: grid;
  gap: 4px;
  overflow-y: auto;
}

.arcadeBoardRow {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-bottom: 1px dashed rgba(38, 35, 31, 0.3);
}

.arcadeBoardRow.me {
  background: var(--highlighter, rgba(246, 214, 64, 0.52));
}

.arcadeRank,
.arcadeBoardBest {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 16px;
}

.arcadeBoardName {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The play layer: the drill on its own pencil field, over everything. */
.arcadePlay {
  --tray-h: 0px;
  position: absolute;
  inset: 0;
  z-index: 50;
  overflow: hidden;
  background: #f3ead6;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.arcadePlay[hidden] {
  display: none;
}

.arcadeCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.arcadeHud {
  position: absolute;
  top: calc(10px + var(--safe-top));
  left: calc(12px + var(--safe-left));
  right: calc(12px + var(--safe-right));
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  pointer-events: none;
}

.arcadeLives {
  display: flex;
  gap: 4px;
}

.arcadeHelmet svg {
  width: 30px;
  height: 26px;
}

.arcadeHelmet .helmetShell {
  fill: var(--pen-blue);
  stroke: var(--marker);
  stroke-width: 2;
  stroke-linejoin: round;
}

.arcadeHelmet .helmetMask,
.arcadeHelmet .helmetStripe {
  fill: none;
  stroke: var(--marker);
  stroke-width: 2;
  stroke-linecap: round;
}

.arcadeHelmet .helmetStripe {
  stroke: #fffaf0;
}

/* A lost life: a grey helmet with a pencil X through it. */
.arcadeHelmet.lost {
  position: relative;
  opacity: 0.55;
}

.arcadeHelmet.lost .helmetShell {
  fill: #d8ccb3;
}

.arcadeHelmet.lost::after {
  content: "";
  position: absolute;
  inset: 2px 3px;
  background:
    linear-gradient(35deg, transparent 46%, var(--pen-red) 46% 56%, transparent 56%),
    linear-gradient(-35deg, transparent 46%, var(--pen-red) 46% 56%, transparent 56%);
}

.arcadeStreakBox,
.arcadeBestBox {
  display: grid;
  justify-items: center;
  line-height: 1;
}

.arcadeBestBox {
  justify-self: end;
}

.arcadeStreakBox b,
.arcadeBestBox b {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-weight: normal;
}

.arcadeStreakBox b {
  font-size: 44px;
  color: var(--pen-blue);
  text-shadow: 2px 2px 0 rgba(38, 35, 31, 0.15);
}

.arcadeBestBox b {
  font-size: 24px;
}

.arcadeStreakLabel {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--graphite);
}

.arcadePoints {
  margin-top: 2px;
  font-size: 12px;
  color: var(--pen-red);
}

.arcadeGameTitle {
  position: absolute;
  top: calc(66px + var(--safe-top));
  left: 0;
  right: 0;
  margin: 0;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 15px;
  text-align: center;
  color: var(--graphite);
  pointer-events: none;
}

.arcadeHint {
  position: absolute;
  top: calc(96px + var(--safe-top));
  left: 50%;
  max-width: calc(100% - 40px);
  margin: 0;
  padding: 6px 12px 7px;
  background: var(--sticky, #fff3a6);
  box-shadow: 2px 3px 0 rgba(86, 81, 73, 0.22);
  font-size: 15px;
  text-align: center;
  transform: translateX(-50%) rotate(-1.5deg);
  pointer-events: none;
}

.arcadeHint[hidden] {
  display: none;
}

.arcadeQuit {
  position: absolute;
  bottom: calc(14px + var(--safe-bottom));
  left: calc(14px + var(--safe-left));
  min-height: 38px;
  margin: 0;
  padding: 4px 14px;
  border: 2px solid var(--marker);
  border-radius: 10px 6px 12px 7px;
  background: #fffaf0;
  box-shadow: 2px 3px 0 rgba(86, 81, 73, 0.25);
  color: var(--marker);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 15px;
  letter-spacing: 0.04em;
  transform: rotate(-2deg);
}

.arcadePlay .arcadeAssist {
  bottom: calc(70px + var(--safe-bottom));
}

.arcadeStick {
  position: absolute;
  width: 92px;
  height: 92px;
  margin: -46px 0 0 -46px;
  border: 2.5px dashed rgba(38, 35, 31, 0.55);
  border-radius: 50% 47% 52% 49%;
  background: rgba(255, 250, 240, 0.28);
  pointer-events: none;
}

.arcadeStick[hidden] {
  display: none;
}

.arcadeStick .stickKnob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  border: 2.5px solid var(--marker);
  border-radius: 48% 52% 50% 50%;
  background: radial-gradient(circle at 38% 34%, #fffaf0, #dce9fb 70%);
  box-shadow: 2px 3px 0 rgba(86, 81, 73, 0.28);
  transform: translate(-50%, -50%);
}

.arcadeStick.moved {
  border-style: solid;
  border-color: rgba(47, 95, 181, 0.6);
}

.arcadeOver {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(226, 216, 196, 0.8);
}

.arcadeOver[hidden] {
  display: none;
}

.arcadeOverCard {
  width: min(340px, 100%);
  text-align: center;
}

.arcadeOverNumbers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 6px 0;
}

.arcadeOverNumbers div {
  display: grid;
  justify-items: center;
}

.arcadeOverNumbers b {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-weight: normal;
  font-size: 48px;
  line-height: 1;
}

.arcadeOverNumbers div:first-child b {
  color: var(--pen-blue);
}

.arcadeNewBest {
  justify-self: center;
  margin: 2px auto 4px;
  padding: 2px 10px;
  border: 2.5px solid var(--pen-red);
  border-radius: 5px 8px 4px 7px;
  width: fit-content;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 20px;
  color: var(--pen-red);
  transform: rotate(-4deg);
}

.arcadeNewBest[hidden] {
  display: none;
}

.arcadeOverRewards:empty {
  display: none;
}

/* ---------- WEEKLY SEASON (BIG UPDATE part 3) ---------- */
.seasonBody {
  display: grid;
  gap: 14px;
  margin: 8px 0 12px;
  text-align: left;
}

.seasonRecord {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 10px 12px 12px;
  border: 2px solid var(--marker);
  border-radius: 4px 8px 5px 10px;
  background: #fffaf0;
  box-shadow: 2px 3px 0 rgba(86, 81, 73, 0.22);
  transform: rotate(-0.6deg);
}

.seasonRecordLabel,
.seasonMatchRound {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--graphite);
}

.seasonRecordText {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-weight: normal;
  font-size: 54px;
  line-height: 1;
  color: var(--pen-blue);
}

.seasonStatus {
  margin: 4px 0 0;
  font-family: "Paper Hand", cursive;
  font-size: 15px;
  text-align: center;
}

.seasonMatch {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  background: var(--sticky, #fff3a6);
  box-shadow: 2px 3px 0 rgba(86, 81, 73, 0.22);
  transform: rotate(0.6deg);
}

.seasonMatchVs {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-weight: normal;
  font-size: 22px;
}

.seasonMatchWhen {
  margin: 0;
  font-family: "Paper Hand", cursive;
  font-size: 14px;
}

.menuCard .seasonPlay {
  margin: 4px 0 0;
}

.seasonHeading {
  margin: 0 0 6px;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-weight: normal;
  font-size: 18px;
  letter-spacing: 0.04em;
}

/* The bracket on a sheet of notebook paper: blue rules, a red margin line across the top. */
.notebookBracket {
  overflow-x: auto;
  padding: 8px 4px 6px;
  border: 1.5px solid rgba(38, 35, 31, 0.45);
  border-radius: 3px;
  background-color: #fffdf6;
  background-image:
    linear-gradient(180deg, transparent 22px, rgba(208, 80, 70, 0.5) 22px 23.5px, transparent 23.5px),
    repeating-linear-gradient(0deg, transparent 0 22px, rgba(70, 120, 200, 0.18) 22px 23px);
  box-shadow: 2px 3px 0 rgba(86, 81, 73, 0.18);
}

.notebookSvg {
  display: block;
  margin: 0 auto;
}

.notebookSvg path {
  fill: none;
  stroke-linecap: round;
}

.notebookSvg .pencilLine {
  stroke: rgba(86, 81, 73, 0.55);
  stroke-width: 1.2;
  stroke-dasharray: 3 4;
}

.notebookSvg .penLine {
  stroke: #1f4fae;
  stroke-width: 2.2;
}

.notebookSvg .penLine.thin {
  stroke-width: 1.4;
  opacity: 0.75;
}

.notebookSvg text {
  font-family: "Paper Hand", cursive;
  font-size: 12px;
}

.notebookSvg .penName {
  fill: #1f4fae;
}

.notebookSvg .penName.won {
  font-weight: 700;
}

.notebookSvg .penName.out {
  fill: rgba(86, 81, 73, 0.7);
  text-decoration: line-through;
}

.notebookSvg .byeName,
.notebookSvg .pencilName {
  fill: rgba(86, 81, 73, 0.7);
}

.notebookSvg .roundName {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 10.5px;
  fill: var(--graphite);
  letter-spacing: 0.06em;
}

.notebookSvg .liveTag {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 10.5px;
  fill: #c0392b;
}

.bracketTrophy path {
  fill: none;
  stroke: rgba(86, 81, 73, 0.6);
  stroke-width: 2;
  stroke-linejoin: round;
}

.bracketTrophy.won path {
  fill: #f3cf63;
  stroke: var(--marker);
}

.standings {
  display: grid;
  gap: 0;
}

.standingRow {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto auto;
  align-items: baseline;
  gap: 8px;
  padding: 5px 4px;
  border-bottom: 1px solid rgba(70, 120, 200, 0.25);
}

.standingRow.me {
  background: var(--highlighter, rgba(246, 214, 64, 0.52));
}

.standingRank,
.standingRecord {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 15px;
}

.standingName {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.standingPoints {
  font-size: 12px;
  color: var(--graphite);
}

/* The cut line under 8th: a red pen dashed line with its label. */
.playoffLine {
  margin: 4px 0;
  padding-top: 2px;
  border-top: 2px dashed #c0392b;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #c0392b;
  text-align: right;
}

.seasonRuleList {
  margin: 0;
  padding-left: 20px;
  font-family: "Paper Hand", cursive;
  font-size: 14px;
}

.seasonRuleList li + li {
  margin-top: 4px;
}

/* ---------- TROPHIES AND TITLES (BIG UPDATE part 4) ---------- */
/* A title holder's name: gold ink with a darker edge so it still reads on cream paper. */
.goldName,
.binderCard .goldName {
  color: #b8860b !important;
  text-shadow: 0 1px 0 rgba(120, 80, 0, 0.35);
}

/* A profile opened from a list sits over that list. */
#profileScreen {
  z-index: 46;
}

[data-profile] {
  cursor: pointer;
}

.crownIcon {
  width: 22px;
  height: 17px;
  margin-right: 4px;
  vertical-align: -2px;
}

.crownIcon .crownFill,
.modeCard .crownFill,
.entranceCrown .crownFill {
  fill: #f3cf63;
  stroke: var(--marker);
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.crownIcon .crownBand,
.entranceCrown .crownBand {
  fill: none;
  stroke: var(--marker);
  stroke-width: 1.3;
}

.crownIcon circle {
  fill: #d8402e;
}

/* The trophy case: cups on a pencil shelf, each with an engraved plate. */
.trophyCase {
  margin: 12px 0;
  padding: 10px 10px 12px;
  border: 2px solid rgba(38, 35, 31, 0.6);
  border-radius: 4px 6px 4px 8px;
  background: #fffaf0;
  box-shadow: 2px 3px 0 rgba(86, 81, 73, 0.18);
}

.trophyCaseTitle {
  margin: 0 0 6px;
}

.trophyShelfRow {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px 8px;
  padding-bottom: 6px;
  border-bottom: 3px solid rgba(120, 90, 50, 0.55);
  box-shadow: 0 3px 0 rgba(120, 90, 50, 0.18);
}

.trophyItem {
  display: grid;
  justify-items: center;
  gap: 3px;
  margin: 0;
}

.cup {
  width: 46px;
  height: 56px;
}

.cup.founders {
  width: 62px;
  height: 72px;
}

.cup path {
  stroke: var(--marker);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  fill: none;
}

.cup.weekly .cupBody,
.cup.weekly .cupBase {
  fill: #dfe3ea;
}

.cup.invite .cupBody,
.cup.invite .cupBase,
.cup.founders .cupBody,
.cup.founders .cupBase {
  fill: #f3cf63;
}

.cup .cupStar {
  fill: #fffaf0;
  stroke-width: 1.2;
}

.cup.founders .cupRibbon {
  stroke: #c0392b;
  stroke-width: 2.6;
}

.trophyPlate {
  display: grid;
  justify-items: center;
  gap: 1px;
  padding: 3px 5px 4px;
  border: 1.5px solid rgba(120, 90, 50, 0.6);
  border-radius: 2px;
  background: linear-gradient(180deg, #f1e3bd, #e2cf9b);
  text-align: center;
}

.trophyName {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-weight: normal;
  font-size: 11px;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.trophyEngraving {
  font-size: 11px;
  line-height: 1.15;
  color: #5a4520;
}

.titleHeld {
  margin: 8px 0 0;
  font-size: 15px;
}

.titleHeld b {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-weight: normal;
  color: #b8860b;
}

.reignRecord {
  margin: 4px 0 0;
}

/* TITLES: a card per league. */
.titlesBody {
  display: grid;
  gap: 10px;
  margin: 8px 0 12px;
  text-align: left;
}

.titleCard {
  display: grid;
  gap: 3px;
  padding: 9px 12px 10px;
  border: 1.5px solid rgba(38, 35, 31, 0.7);
  border-radius: 3px 4px 3px 12px;
  background: #fffaf0;
  box-shadow: 2px 3px 0 rgba(86, 81, 73, 0.2);
}

.titleCard.mine {
  border-width: 2.5px;
  background: #fff8dc;
}

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

.titleName {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-weight: normal;
  font-size: clamp(16px, 4.8vw, 20px);
}

.titleYours {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 11px;
  color: var(--pen-blue);
}

.titleHolder {
  margin: 0;
  font-size: 17px;
}

.titleHolder.vacant {
  color: var(--graphite);
}

.titleMeta,
.titleRecord,
.titleQueue,
.titleLiveLine {
  margin: 0;
  font-family: "Paper Hand", cursive;
  font-size: 14px;
  color: var(--graphite);
}

.titleLive {
  display: grid;
  gap: 4px;
  margin-top: 4px;
  padding: 6px 8px;
  background: var(--sticky, #fff3a6);
}

.menuCard .titlePlay {
  margin: 2px 0 0;
}

.titleActions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.titleLocked {
  font-size: 13px;
  color: var(--graphite);
}

/* INVITATIONAL */
.inviteEntry {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 2.5px dashed rgba(38, 35, 31, 0.55);
  border-radius: 6px;
  background: #fffaf0;
  text-align: center;
}

.inviteEntry.ok {
  border-style: solid;
  border-color: #b8860b;
  background: #fff8dc;
}

.inviteEntryTitle,
.inviteOpenTitle {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-weight: normal;
  font-size: 20px;
}

.inviteEntryLine,
.inviteOpenLine,
.inviteJoined {
  margin: 0;
  font-family: "Paper Hand", cursive;
  font-size: 14px;
}

.inviteOpen {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1.5px solid rgba(38, 35, 31, 0.7);
  border-radius: 3px 4px 3px 12px;
  background: #fffaf0;
  box-shadow: 2px 3px 0 rgba(86, 81, 73, 0.2);
}

.menuCard .inviteJoin {
  margin: 4px 0 0;
}

/* The title holder's entrance: a taped banner that drops in over the huddle, then goes. */
.titleEntrance {
  position: absolute;
  inset: 0;
  z-index: 44;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.titleEntrance[hidden] {
  display: none;
}

.entranceCard {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 14px 24px 16px;
  border: 3px solid var(--marker);
  border-radius: 6px 10px 5px 12px;
  background: #fff8dc;
  box-shadow: 4px 6px 0 rgba(86, 81, 73, 0.3), 0 0 0 9999px rgba(38, 35, 31, 0.12);
  transform: rotate(-3deg);
}

.titleEntrance.go .entranceCard {
  animation: entranceDrop 2.4s cubic-bezier(.3, 1.4, .5, 1) forwards;
}

.titleEntrance.reduce.go .entranceCard {
  animation: entranceFade 2.4s linear forwards;
}

.entranceCrown {
  width: 64px;
  height: 48px;
}

.entranceTitle {
  margin: 0;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 22px;
  letter-spacing: 0.04em;
  color: #b8860b;
  text-align: center;
}

.entranceName {
  margin: 0;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 26px;
}

@keyframes entranceDrop {
  0% { opacity: 0; transform: translateY(-60px) rotate(-12deg) scale(0.7); }
  14% { opacity: 1; transform: translateY(0) rotate(-3deg) scale(1.05); }
  22% { transform: rotate(-3deg) scale(1); }
  82% { opacity: 1; transform: rotate(-3deg) scale(1); }
  100% { opacity: 0; transform: translateY(30px) rotate(2deg) scale(0.9); }
}

@keyframes entranceFade {
  0% { opacity: 0; }
  10%, 85% { opacity: 1; }
  100% { opacity: 0; }
}

/* ---------- BUILD 3: the stats bar and a slimmer header ---------- */
/* Avatar, @name, league, coins and ink in one slim bar across the very top of the screen, right under the status
   bar, on every page of the binder. The page's own top keeps just a smaller logo and the sound and gear buttons. */
#mainMenu.binderOverlay {
  padding-top: var(--safe-top);
}

.binderCard .statsBar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  box-sizing: border-box;
  height: 42px;
  margin: 0 calc(-2px - var(--safe-right)) 6px calc(-16px - var(--safe-left));
  padding: 0 calc(8px + var(--safe-right)) 0 calc(8px + var(--safe-left));
  background: rgba(10, 28, 74, 0.5);
  border-bottom: 2px solid rgba(6, 18, 50, 0.35);
}

.binderCard .statsBar .avatarButton {
  flex: 0 1 auto;
  gap: 5px;
  min-width: 0;
  max-width: none;
  min-height: 32px;
  height: 32px;
  padding: 1px 8px 1px 1px;
  box-shadow: 1px 2px 0 rgba(6, 18, 50, 0.35);
}

.binderCard .statsBar .avatarFace canvas {
  width: 28px;
  height: 28px;
}

.binderCard .statsBar .avatarText {
  flex: 1 1 auto;
  gap: 0;
  overflow: hidden;
}

.binderCard .statsBar .avatarName,
.binderCard .statsBar .avatarButton .avatarName.username {
  display: block;
  width: 100%;
  font-size: 15px;
  line-height: 1.05;
}

.binderCard .statsBar .leagueBadge {
  font-size: 8px;
  line-height: 1.35;
}

.binderCard .statsBar .walletPills {
  flex: 0 0 auto;
  margin-left: auto;
  gap: 4px;
}

.binderCard .statsBar .walletPill {
  min-height: 30px;
  height: 30px;
  gap: 3px;
  padding: 0 2px 0 2px;
  font-size: 14px;
  box-shadow: 1px 2px 0 rgba(6, 18, 50, 0.35);
}

.binderCard .statsBar .walletIcon,
.binderCard .statsBar .walletIcon svg {
  width: 21px;
  height: 21px;
}

.binderCard .statsBar .inkIcon .inkBottle {
  width: 18px;
  height: 21px;
}

.binderCard .statsBar .walletPlus {
  width: 18px;
  height: 18px;
  font-size: 15px;
}

.binderCard .binderTop {
  padding: 3px 8px 2px 12px;
}

.binderCard .binderTop .topRow {
  align-items: center;
}

.binderCard .logoArt {
  width: clamp(104px, 31vw, 128px);
}

.binderCard .binderTop .binderIcons {
  align-self: center;
  gap: 5px;
}

.binderCard .binderTop .doodleIcon {
  width: 30px;
  height: 30px;
}

/* ---------- LAYOUT AND PACKS: odds sheet columns, the GOAT METER, the Gold Foil treatment ---------- */
.oddsTable.fourColumns {
  font-size: 15px;
}

.oddsTable.fourColumns th {
  font-size: 12px;
  line-height: 1.1;
}

.oddsTable tfoot td {
  border-top: 2px solid rgba(43, 40, 35, 0.45);
  font-family: "Marker Display", "Paper Hand", cursive;
  color: #8a6408;
}

.oddsTable tfoot td:first-child {
  text-align: left;
}

/* The small pencil meter on a Gold Foil pack: 8 ticks, the filled ones inked. */
.goatMeter {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-family: "Paper Hand", cursive;
  font-size: 12px;
  line-height: 1;
  color: var(--graphite);
  transform: rotate(-2deg);
}

.goatMeter b {
  font-weight: normal;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.goatTicks {
  display: flex;
  gap: 2px;
}

.goatTicks i {
  width: 8px;
  height: 9px;
  border: 1.4px solid rgba(43, 40, 35, 0.7);
  border-radius: 2px 3px 2px 3px;
}

.goatTicks i.on {
  background: repeating-linear-gradient(135deg, #b8860b 0 2px, #e9b93a 2px 3.5px);
}

.goatMeter.full b {
  color: #a87a12;
}

/* Rip and haul in gold. */
#packOpening.goldFoil {
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 244, 190, 0.98), rgba(233, 196, 98, 0.98) 72%),
    #e9c462;
}

#packOpening.goldFoil::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 0 30%, rgba(255, 255, 255, 0.35) 40%, transparent 50% 100%);
  background-size: 260% 100%;
  animation: goldSweep 3.2s ease-in-out infinite;
  pointer-events: none;
}

.bigPack.pack-gold.shaking {
  animation: packShakeHard 0.08s linear infinite;
}

.bigPack.pack-gold .packShine::before {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 240, 1), transparent);
  animation-duration: 1.6s;
}

.haulTitle.pack-gold {
  color: #8a6408;
  text-shadow: 1px 1px 0 #fff4c2, 2px 2px 0 rgba(138, 100, 8, 0.35);
}

.haulMeter {
  margin: 4px 0 0;
  font-family: "Paper Hand", cursive;
  font-size: 15px;
  color: #6b4d06;
}

@keyframes goldSweep {
  0% { background-position: 100% 0; }
  100% { background-position: -60% 0; }
}

@media (prefers-reduced-motion: reduce) {
  #packOpening.goldFoil::before {
    animation: none;
  }
}

.packDetail .goatMeter {
  display: flex;
  margin: 4px auto 0;
}

.storeFeaturedMeter {
  display: block;
  margin-top: 4px;
}

.storeFeaturedMeter[hidden] {
  display: none;
}

#packOpening.goldFoil .summaryCoins,
#packOpening.goldFoil .haulCount {
  color: #5a3f05;
}

/* ---------- BUILD 8 FIXES: the level up sticky note on the card inspect ---------- */
.levelUpNote {
  display: grid;
  grid-template-columns: auto auto;
  gap: 1px 16px;
  max-width: 320px;
  margin: 2px 0 0;
  padding: 8px 14px 9px;
  border: 2px solid var(--marker);
  border-radius: 3px 3px 10px 4px;
  background: linear-gradient(180deg, #fff3c9, var(--sticky) 72%, #efd98c);
  box-shadow: 3px 4px 0 rgba(38, 35, 31, 0.25);
  color: var(--marker);
  font-family: "Paper Hand", cursive;
  font-size: 15px;
  line-height: 1.2;
  text-align: left;
  transform: rotate(-2deg);
  animation: stampIn 0.3s ease-out;
}

.levelUpNote[hidden] {
  display: none;
}

.levelUpNote .wide {
  grid-column: 1 / -1;
}

.levelUpNote strong {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-weight: normal;
  font-size: 17px;
  color: #2e7d4f;
}

/* BUILD 8 FIXES: the snap's juice pops "+3" on the meter. */
#snapJuicePop {
  position: absolute;
  right: 30px;
  bottom: 16px;
  padding: 0 6px;
  border: 2px solid #2e7d4f;
  border-radius: 6px 4px 7px 5px;
  background: #e6f6dc;
  color: #2e7d4f;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 15px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: rotate(4deg);
}

#snapJuicePop.show {
  animation: snapJuicePop 1.3s ease-out forwards;
}

@keyframes snapJuicePop {
  0% { opacity: 0; transform: translateY(8px) scale(0.6) rotate(4deg); }
  15% { opacity: 1; transform: translateY(-2px) scale(1.2) rotate(4deg); }
  30% { transform: translateY(0) scale(1) rotate(4deg); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-14px) scale(1) rotate(4deg); }
}

@media (prefers-reduced-motion: reduce) {
  #snapJuicePop.show {
    animation: none;
    opacity: 1;
  }
}

/* ACHIEVEMENTS: the profile tabs, the TROPHY ROOM, the result screen list, the mid match stamp, the dot. */
.menuCard .profileTabs {
  grid-template-columns: repeat(2, 1fr);
}

.profileTabs button {
  position: relative;
}

.profileTabs .tabDot {
  top: -4px;
  right: -3px;
}

.binderCard .avatarButton {
  position: relative;
}

.profileDot {
  top: -3px;
  right: auto;
  left: 30px;
}

.menuCard .trophyRoomRules {
  margin: 0 0 4px;
  font-size: 12px;
}

.menuCard .achGroup {
  margin: 12px 0 4px;
}

.achList {
  display: grid;
  gap: 8px;
}

.achRow {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "medals words claim" "line line line";
  align-items: center;
  gap: 2px 8px;
  padding: 8px 10px 4px;
  background: #fffaf0;
  border: 1.5px solid var(--marker, #26231f);
  border-radius: 10px 14px 9px 12px;
  box-shadow: 2px 3px 0 rgba(43, 40, 35, 0.16);
}

.achRow.ready {
  background: #fff6c8;
}

.achRow.done {
  background: #f6fbe9;
}

.achRow.masked {
  background: #f1ece0;
  grid-template-areas: "medals words claim";
}

.achMedals {
  grid-area: medals;
  display: flex;
  align-items: flex-end;
  gap: 1px;
}

.achMedals .medal {
  display: block;
}

.achWords {
  grid-area: words;
  min-width: 0;
}

.menuCard .achName {
  margin: 0;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 16px;
  line-height: 1.1;
}

.menuCard .achText,
.menuCard .achReward {
  margin: 0;
  font-size: 12px;
  line-height: 1.2;
}

.achText {
  opacity: 0.8;
}

.achReward {
  color: #6b5a12;
}

.menuCard .achClaim {
  grid-area: claim;
  width: auto;
  margin: 0;
  padding: 6px 10px;
}

.achLine {
  grid-area: line;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.achBar {
  width: 170px;
  max-width: 62%;
  height: 28px;
}

.achCount {
  margin-left: 8px;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 14px;
  white-space: nowrap;
}

.resultAchievements {
  display: grid;
  gap: 4px;
  margin: 4px auto 6px;
  max-width: 340px;
}

.menuCard .resultAchKicker {
  margin: 0;
  text-align: center;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 16px;
  color: #8a3a12;
  transform: rotate(-2deg);
}

.resultAchRow {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 6px;
  border: 1.5px dashed rgba(86, 81, 73, 0.6);
  border-radius: 8px;
  background: #fffaf0;
  text-align: left;
}

.resultAchMedal svg {
  display: block;
}

.resultAchWords {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  line-height: 1.15;
}

.resultAchWords strong {
  font-family: "Marker Display", "Paper Hand", cursive;
  font-weight: normal;
}

.menuCard .resultAchClaim {
  width: auto;
  margin: 0;
  padding: 4px 10px;
  min-height: 32px;
}

.resultAchDone {
  font-size: 13px;
}

/* Off to the side, under the scoreboard, and only while the ball is dead (achievement-stamp.js). */
.achievementStamp {
  position: absolute;
  top: calc(112px + var(--safe-top));
  right: calc(10px + var(--safe-right));
  z-index: 6;
  display: grid;
  max-width: 46%;
  padding: 3px 9px 4px;
  border: 2.5px solid #8a3a12;
  border-radius: 7px 5px 8px 4px;
  background: rgba(255, 246, 200, 0.95);
  color: #8a3a12;
  box-shadow: 2px 3px 0 rgba(86, 81, 73, 0.2);
  font-family: "Marker Display", "Paper Hand", cursive;
  text-align: center;
  pointer-events: none;
  transform: rotate(-5deg);
}

.achievementStamp[hidden] {
  display: none;
}

.achievementStampKicker {
  font-size: 15px;
  letter-spacing: 0.5px;
}

.achievementStampName {
  font-family: "Paper Hand", cursive;
  font-size: 12px;
  line-height: 1.1;
  color: #3d3a46;
}

.achievementStamp.show {
  animation: achievementStamp 0.45s ease-out;
}

@keyframes achievementStamp {
  0% { opacity: 0; transform: scale(1.8) rotate(-12deg); }
  60% { opacity: 1; transform: scale(0.92) rotate(-4deg); }
  100% { transform: scale(1) rotate(-5deg); }
}

@media (prefers-reduced-motion: reduce) {
  .achievementStamp.show {
    animation: none;
  }
}

/* Build 19 sticker art: depth on the faces, and the new parts' colors. */
.emoteArt .shade { fill: rgba(214, 120, 30, 0.28); stroke: none; }
.emote-angry .shade { fill: rgba(190, 50, 30, 0.3); }
.emoteArt .gloss { stroke: #ffffff; stroke-width: 2.6; opacity: 0.9; }
.emoteArt .teeth { fill: #ffffff; stroke-width: 1.4; }
.emoteArt .cuff { fill: #4a7bd8; stroke-width: 2.2; }
.emoteArt .vein { stroke: #d02a2a; stroke-width: 2.2; }
.emoteArt .bridge { stroke-width: 3.4; }
.emoteArt .glintDot { stroke: #ffffff; stroke-width: 2.4; }
.emoteArt .star { fill: #f7c932; stroke-width: 1.6; }
.emoteArt .crack { stroke-width: 2; }
.emoteArt .swirl { stroke-width: 2.2; }
.emoteArt .puff { fill: #ece7dc; stroke-width: 2; }
.emoteArt .boom.hot { stroke: #f2b21c; }
.emoteArt .cap { fill: #4a6fd8; stroke-width: 2.4; }
.emoteArt .capBand { fill: #ffffff; stroke-width: 1.8; }
.emoteArt .capBill { fill: #2f4fa8; stroke-width: 2.2; }
.emoteArt .pom { fill: #ffffff; stroke-width: 2; }
.emoteArt .brow { stroke-width: 3.4; }
.emoteArt .heartShade { fill: rgba(140, 10, 40, 0.3); stroke: none; }
.emoteArt .mini { fill: #ff8fa3; stroke-width: 1.6; }
.emoteArt .paperLines { stroke: rgba(74, 143, 216, 0.35); stroke-width: 1.2; }
.emoteArt .letterShadow { stroke: rgba(31, 34, 53, 0.25); stroke-width: 4.2; }
.emoteArt .check { stroke: #2e9a52; stroke-width: 3; }
.emoteArt .bagShade { fill: rgba(110, 70, 20, 0.3); stroke: none; }
.emoteArt .rope { stroke: #7a4a1c; stroke-width: 3; }
.emoteArt .bill { fill: #8fd19e; stroke: #2e7d4f; stroke-width: 1.8; }
.emoteBubble.pop .bill,
.looping .bill { animation: stickerFloatUp 1.2s ease-out infinite; }
.emoteBubble.pop .mini,
.looping .mini { animation: stickerFloatUp 1.4s ease-out infinite; }
.emoteBubble.pop .puff,
.looping .puff { animation: stickerBreathe 0.5s ease-in-out infinite alternate; }
.emoteBubble.pop .swirl,
.looping .swirl { animation: stickerSpin 0.9s linear infinite; }
.emoteBubble.pop .pom,
.looping .pom { animation: stickerSway 0.8s ease-in-out infinite alternate; }
@keyframes stickerSpin {
  to { transform: rotate(360deg); }
}

/* Build 19: each ink bundle has its own art (src/ink-art.js), bigger and fancier with the bundle. */
.inkBundle .inkBundleArt {
  width: 64px;
  height: 64px;
  margin: -2px 0 0;
}
.inkBundle .inkBundleArt.inkSize0 { width: 52px; height: 52px; margin: 6px 0 4px; }
.inkBundle .inkBundleArt.inkSize1 { width: 58px; height: 58px; margin: 3px 0 1px; }
.inkBundle .inkBundleArt.inkSize3 { width: 70px; height: 70px; margin: -4px 0 -2px; }
.storeBottleArt .inkBundleArt {
  display: block;
  width: var(--size, 40px);
  height: var(--size, 40px);
}

/* ---------- Build 19: rarity, the preview sheet, MY LOCKER ---------- */
/* Rarity: a full frame and a glow per tier (never a colored side stripe). */
[data-rarity="common"] { --rarity: #8d877a; --rarity-glow: rgba(141, 135, 122, 0.22); }
[data-rarity="rare"] { --rarity: #3f78e0; --rarity-glow: rgba(63, 120, 224, 0.42); }
[data-rarity="epic"] { --rarity: #9a5ae0; --rarity-glow: rgba(154, 90, 224, 0.48); }
[data-rarity="legendary"] { --rarity: #dca11a; --rarity-glow: rgba(240, 180, 30, 0.6); }

.rarityTag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  color: #ffffff;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.5;
  background: #8d877a;
}
.rarityTag.rarity-rare { background: #3f78e0; }
.rarityTag.rarity-epic { background: #9a5ae0; }
.rarityTag.rarity-legendary { background: linear-gradient(180deg, #f6d35a, #c98c12); color: #3a2804; }

.cosmeticCell[data-rarity] {
  overflow: hidden;
  border-color: var(--rarity);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9) inset, 0 0 10px var(--rarity-glow);
}
.cosmeticCell[data-rarity="epic"] { background: linear-gradient(180deg, #fffdf6 60%, #f6efff); }
.cosmeticCell[data-rarity="legendary"] { background: linear-gradient(180deg, #fffdf2 55%, #fff1c4); border-width: 2.5px; }
.cosmeticCell[data-rarity="legendary"]::after,
.previewPanel[data-rarity="legendary"] .previewStage::after,
.storeLookBox[data-rarity="legendary"]::after {
  content: "";
  position: absolute;
  inset: -40% auto -40% -60%;
  width: 40%;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0), rgba(255, 246, 200, 0.75), rgba(255, 255, 255, 0));
  transform: rotate(12deg);
  animation: raritySheen 3.2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes raritySheen {
  0%, 55% { left: -60%; }
  100% { left: 130%; }
}
.cosmeticCell.on {
  box-shadow: 0 0 0 2px #2a3a8c inset, 0 0 10px var(--rarity-glow, transparent);
}
.cosmeticCell .rarityTag { margin-top: 1px; }

.styleSwitch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 8px 0 2px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  overflow: hidden;
}
.styleSwitch button {
  min-height: 40px;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #fffaf0;
  box-shadow: none;
  font-size: 15px;
}
.styleSwitch button + button { border-left: 2px solid var(--ink); }
.styleSwitch button.active { background: #2a3a8c; color: #fffaf0; }

.cosmeticList { min-width: 0; }
.cosmeticList .cosmeticGrid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
.cosmeticPrice {
  margin-top: 2px;
  padding: 2px 8px;
  border-radius: 8px;
  background: #2a3a8c;
  color: #fffaf0;
  font-size: 13px;
  white-space: nowrap;
}
.cosmeticPrice.owned { background: #2e8a4c; }
.lockerSummary { margin: 8px 0 0; }
.lockerCell { cursor: pointer; }
.lockerCell .equipButton {
  width: 100%;
  min-height: 32px;
  margin-top: 3px;
  padding: 3px 2px;
  font-size: 13px;
}
.lockerCell.on .equipButton,
.lockerCell.on .equipButton:disabled {
  opacity: 1;
  background: #2a3a8c;
  color: #fffaf0;
}
.storeLookBox.tappable { position: relative; overflow: hidden; }
.storeLookBox.tappable .storeLookStage { cursor: zoom-in; }

/* The preview sheet: up from the bottom, over whatever is open. */
.previewSheet {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}
.previewSheet[hidden] { display: none !important; }
.previewScrim {
  position: absolute;
  inset: 0;
  background: rgba(38, 35, 31, 0.55);
  animation: previewFade 0.2s ease-out;
}
.previewPanel {
  position: relative;
  box-sizing: border-box;
  width: min(440px, 100%);
  max-height: calc(100% - 16px - var(--safe-top));
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px 16px calc(16px + var(--safe-bottom));
  border: 2px solid var(--ink);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: #fffdf6;
  box-shadow: 0 -10px 30px rgba(38, 35, 31, 0.28);
  text-align: center;
  touch-action: none;
  transition: transform 0.22s ease-out;
  animation: previewUp 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes previewUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes previewFade { from { opacity: 0; } to { opacity: 1; } }
.previewGrip {
  width: 44px;
  height: 5px;
  margin: 0 auto 8px;
  border-radius: 3px;
  background: rgba(43, 40, 35, 0.3);
}
.previewClose {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
  width: 40px;
  height: 40px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #fffaf0;
  box-shadow: none;
}
.previewClose::before,
.previewClose::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 2.6px;
  margin: -1.3px 0 0 -9px;
  border-radius: 2px;
  background: var(--ink);
  transform: rotate(45deg);
}
.previewClose::after { transform: rotate(-45deg); }
.previewStage {
  position: relative;
  box-sizing: border-box;
  width: calc(100% - 8px);
  margin: 26px auto 10px;
  overflow: hidden;
  border: 3px solid var(--rarity, #8d877a);
  border-radius: 16px;
  background: #f7f1e1;
  box-shadow: 0 0 0 3px #ffffff, 0 0 22px var(--rarity-glow, transparent);
  aspect-ratio: 1 / 0.78;
}
.previewStage canvas { display: block; max-width: 100%; }
.previewEmote {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 45%, #fffdf2, #efe5cc);
}
.previewEmote[hidden] { display: none; }
.previewEmoteArt { display: grid; place-items: center; width: 70%; height: 90%; }
.previewEmoteArt .emoteArt {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(2.4px 0 0 #fff) drop-shadow(-2.4px 0 0 #fff) drop-shadow(0 2.4px 0 #fff) drop-shadow(0 -2.4px 0 #fff) drop-shadow(3px 4px 0 rgba(38, 35, 31, 0.28));
}
.previewMeta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.previewKind { font-size: 13px; letter-spacing: 0.06em; opacity: 0.7; }
.previewMeta .rarityTag { font-size: 11px; padding: 2px 9px; }
.previewName {
  margin: 4px 0 0;
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 30px;
  font-weight: normal;
  line-height: 1.1;
}
.previewPrice { margin: 2px 0 10px; font-size: 18px; }
.previewPrice.owned { color: #2e8a4c; }
.previewActions { display: grid; }
.previewAction {
  width: 100%;
  min-height: 52px;
  margin: 0;
  font-size: 18px;
}
.previewAction.buy { background: #2a3a8c; color: #fffaf0; }
.previewAction.buy.armed { background: #c0392b; }
.previewAction.equip:not(:disabled) { background: #2e8a4c; color: #fffaf0; }
.previewNote { min-height: 20px; margin: 8px 0 0; font-size: 14px; }
.previewMore { display: inline; min-height: 0; margin: 0; padding: 0; font-size: 14px; }

/* Build 19: the shop and store never scroll sideways on a phone. */
.scrollOverlay {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-x: none;
}
.sheetCard,
.shopBlock,
.cosmeticGroup,
.cosmeticGrid,
.inkBundles,
.coinBundles,
.shopPackList,
.shopOffers {
  min-width: 0;
  max-width: 100%;
}
/* The section tabs always fit across: five equal columns, no sideways scrolling of their own. */
.shopTabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  grid-auto-flow: column;
  overflow: hidden;
  max-width: calc(100% + 12px);
  box-sizing: border-box;
}
.shopTabs button {
  min-width: 0;
  padding: 4px 2px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: clip;
  font-size: 12.5px;
}
/* The paper tape on a sheet's top right corner stays inside the phone (it made the sheet 3px wider). */
.scrollOverlay > .sheetCard::after {
  right: -10px;
}
.previewAction.equip:disabled {
  opacity: 1;
  background: #eef6f0;
  border-color: #2e8a4c;
  color: #2e8a4c;
}
/* The preview's big button, in the game's hand drawn button style (the sheet isn't inside a menu card). */
.previewAction {
  border: 2px solid var(--marker);
  border-radius: 4px 10px 6px 8px;
  background: linear-gradient(180deg, #fff3c9, var(--sticky) 72%, #efd98c);
  color: var(--marker);
  font-family: "Marker Display", "Paper Hand", cursive;
  font-size: 22px;
  box-shadow: 3px 3px 0 rgba(86, 81, 73, 0.22);
}
.previewAction:active { transform: translateY(2px) rotate(-0.6deg); box-shadow: 1px 1px 0 rgba(86, 81, 73, 0.22); }
.previewAction.buy { background: linear-gradient(180deg, #4a63c8, #2a3a8c 75%, #1f2c70); color: #fffaf0; }
.previewAction.buy.armed { background: linear-gradient(180deg, #e25a48, #c0392b 75%, #9c2b20); }
.previewAction.equip:not(:disabled) { background: linear-gradient(180deg, #52b874, #2e8a4c 75%, #22703c); color: #fffaf0; }
.previewAction:disabled { box-shadow: none; }

/* Build 20: labels and names always show whole. fit-text.js shrinks them (and wraps a long name to two lines). */
.shopTabs button.fitText,
.styleSwitch button.fitText {
  padding-left: 3px;
  padding-right: 3px;
  overflow: visible;
  text-overflow: clip;
  letter-spacing: 0;
}
.cosmeticCell .cosmeticName {
  align-self: stretch;
  min-width: 0;
  max-width: 100%;
  padding: 0 2px;
  line-height: 1.12;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}
.shopLink {
  display: block;
  width: auto;
  min-height: 36px;
  margin: 10px auto 2px;
  padding: 6px 14px;
  border: 0;
  background: none;
  box-shadow: none;
  font-size: 15px;
}
.cosmeticGroup { scroll-margin-top: 84px; }
