/* PUTTLE 3D — "Sky Clubhouse".
   The UI is the stuff a mini-golf park hands you at the counter: cream card
   stock, navy ink, perforated ticket stubs, a stubby-pencil scorecard and a
   rubber stamp for the big moments. Solid paper and hard ink shadows — no
   frosted glass — so it reads over any sky and costs the GPU nothing. */

:root {
  --paper: #fff4dc;
  --paper-2: #f8e8c6;
  --paper-3: #efd8a8;
  --ink: #1c1640;
  --ink-2: rgba(28, 22, 64, 0.68);
  --ink-3: rgba(28, 22, 64, 0.34);
  --ink-4: rgba(28, 22, 64, 0.12);
  --tee: #ffd23f;
  --stamp: #e2402f;
  --green: #169a55;
  --red: #d8412f;
  --gold: #f2ab00;
  --blue: #2a64d6;
  /* On the 3D scene (not on paper). */
  --under: #6dff9a;
  --over: #ff8a78;
  --ace: #ffd84a;
  --muted: rgba(255, 255, 255, 0.78);
  /* Set per world from main.js. */
  --accent: #ff8ab0;
  --flag: #ff4f86;
  --display: "Bungee", "Arial Black", system-ui, sans-serif;
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --lift: 0 4px 0 var(--ink);
  --lift-lg: 0 6px 0 var(--ink), 0 18px 40px rgba(12, 8, 32, 0.35);
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.36  0 0 0 0 0.26  0 0 0 0 0.12  0 0 0 0.09 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #16113a;
  color: #fff;
  font-family: var(--font);
  font-weight: 500;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}
#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline: none;
}
#ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
#ui button,
#ui select,
#ui a,
#ui .screen,
#ui .modal {
  pointer-events: auto;
}
.hidden {
  display: none !important;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}

/* ── Paper & ink ─────────────────────────────────────────────────────────── */
/* Card stock: every panel, ticket and chip is made of this. */
.title-box,
.res-box,
.panel,
.card,
.hud-c,
.hname,
.mini,
.power,
.hint,
.photo-bar,
.replay-btn,
.coach p {
  background: var(--paper) var(--grain);
  color: var(--ink);
  border: 2.5px solid var(--ink);
}

/* Buttons: tickets you press into the counter. */
button.primary,
button.ghost,
label.ghost {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 2.5px solid var(--ink);
  box-shadow: var(--lift);
  font-family: var(--display);
  font-size: 17px;
  letter-spacing: 0.02em;
  color: var(--ink);
  transition: transform 0.08s, box-shadow 0.08s;
}
button.primary {
  background: var(--tee);
  font-size: 19px;
  padding-right: 64px;
}
/* The ticket stub: a perforation and an arrow on the big button. */
button.primary::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  right: 52px;
  border-left: 2.5px dashed rgba(28, 22, 64, 0.4);
}
button.primary::after {
  content: "›";
  position: absolute;
  right: 0;
  width: 52px;
  text-align: center;
  font-size: 26px;
  line-height: 1;
}
button.ghost,
label.ghost {
  background: var(--paper) var(--grain);
}
button.primary:active,
button.ghost:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 var(--ink);
}
/* Keyboard focus: a bold blue ring that reads on paper and on sky alike. */
#ui :focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
#ui .link:focus-visible,
#ui a:focus-visible {
  border-radius: 4px;
}
.link {
  font-family: var(--font);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink-2);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  justify-self: center;
}
a.link {
  display: inline-block;
}
.link.small {
  font-size: 12.5px;
  font-weight: 500;
}
.btns {
  display: grid;
  gap: 10px;
}
.btn-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 10px;
}
.btn-row button.ghost {
  font-size: 15px;
  min-height: 48px;
  padding: 10px 8px;
}
/* A star count riding on the button as a stub badge. */
.btn-row .ghost small {
  position: absolute;
  top: -9px;
  right: -6px;
  padding: 1px 6px;
  border-radius: 6px;
  border: 2px solid var(--ink);
  background: var(--tee);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 800;
  font-size: 11.5px;
  transform: rotate(4deg);
}
.btn-row button.next-course {
  background: #9ee6ff;
}
.dot {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--stamp);
  border: 2.5px solid var(--ink);
}

/* Pencil marks: golf scorecard notation, drawn by hand. */
.mk {
  --mk: 36px;
  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: var(--mk);
  height: var(--mk);
  line-height: 1;
  font-family: var(--display);
}
.mk.birdie,
.mk.eagle {
  color: var(--green);
  border: 2.5px solid currentColor;
  border-radius: 52% 47% 55% 45% / 48% 55% 45% 52%;
  transform: rotate(-4deg);
}
.mk.eagle {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
.mk.bogey,
.mk.dbl {
  color: var(--red);
  border: 2.5px solid currentColor;
  border-radius: 3px 5px 2px 4px;
  transform: rotate(3deg);
}
.mk.dbl {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
.mk.ace {
  color: var(--ink);
  background: var(--tee);
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--gold);
}
.mk.par {
  color: var(--ink);
}

/* ── HUD: a scorecard strip clipped to the top of the screen ──────────── */
#hud {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  padding: calc(10px + var(--safe-t)) 12px 10px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 10px;
}
.hud-l {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}
.pips {
  display: flex;
  gap: 5px;
  padding-left: 2px;
}
.pips i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  box-shadow: 0 2px 0 var(--ink);
}
.pips i.cur {
  background: var(--tee);
  transform: scale(1.18);
}
.pips i.under {
  background: #7fe0a5;
}
.pips i.even {
  background: var(--paper-3);
}
.pips i.over {
  background: #ff9d8d;
}
.pips i.ace {
  background: var(--tee);
  box-shadow: 0 2px 0 var(--ink), 0 0 10px var(--ace);
}
/* A new player's warm-up hole: a tag in place of the pips, with a way out. */
.warm {
  display: none;
  align-self: flex-start;
  align-items: center;
  gap: 8px;
  padding: 3px 4px 3px 10px;
  border-radius: 999px;
  background: var(--paper) var(--grain);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  box-shadow: 0 2px 0 var(--ink);
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.warm b {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--tee);
  border: 2px solid var(--ink);
  font-size: 11px;
}
body.warming .warm {
  display: inline-flex;
}
body.warming .pips,
body.warming .hud-c .stat:nth-child(3) {
  display: none;
}
.hname {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  max-width: 100%;
  padding: 4px 12px 4px 4px;
  border-radius: 10px;
  box-shadow: var(--lift);
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
}
.hname b {
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--ink);
  color: var(--tee);
  font-family: var(--display);
  font-weight: 400;
  font-size: 14px;
}
.hname i {
  font-style: normal;
  font-size: 15px;
  line-height: 1;
  order: 3;
}
.hname span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.hud-c {
  display: flex;
  border-radius: 12px;
  box-shadow: var(--lift);
  overflow: hidden;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 52px;
  padding: 5px 8px 6px;
  line-height: 1;
}
.stat + .stat {
  border-left: 2px dashed var(--ink-3);
}
.stat span {
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-2);
}
.stat b {
  margin-top: 4px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 21px;
}
.stat b.bump {
  animation: bump 0.45s cubic-bezier(0.3, 1.8, 0.5, 1);
}
.stat b.under {
  color: var(--green);
}
.stat b.over {
  color: var(--red);
}
.stat.gem span,
.stat.ghost span {
  font-size: 12px;
  letter-spacing: 0;
}
.stat.ghost {
  background: #dff1ff;
}
.stat.ghost b {
  color: var(--blue);
}
.stat.ghost b.under {
  color: var(--green);
}
.stat.ghost b.over {
  color: var(--red);
}
.hud-r {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}
.icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--paper) var(--grain);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  box-shadow: var(--lift);
  transition: transform 0.08s, box-shadow 0.08s;
}
.icon:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 var(--ink);
}
.icon svg {
  width: 21px;
  height: 21px;
}
.icon.on {
  background: var(--tee);
}
#btnSound .x {
  display: none;
}
#btnSound.off .x {
  display: block;
}
#btnSound.off path.on {
  opacity: 0.35;
}
body[data-mode="photo"] #hud {
  opacity: 0;
  pointer-events: none;
}
body[data-mode="replay"] #hud,
body[data-mode="transition"] #hud {
  opacity: 0;
  transition: opacity 0.3s;
}
@media (max-width: 560px) {
  #hud {
    grid-template-columns: 1fr auto;
    grid-template-areas: "l r" "c c";
    row-gap: 8px;
  }
  .hud-l {
    grid-area: l;
  }
  .hud-r {
    grid-area: r;
  }
  .hud-c {
    grid-area: c;
    justify-self: center;
  }
  .icon {
    width: 38px;
    height: 38px;
  }
}

/* ── Aiming ───────────────────────────────────────────────────────────────── */
.hint {
  position: absolute;
  left: 50%;
  bottom: calc(22px + var(--safe-b));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 28px);
  padding: 9px 16px;
  border-radius: 12px;
  box-shadow: var(--lift);
  font-size: 14px;
  text-align: center;
  animation: bob 2.4s ease-in-out infinite;
}
.hint b {
  font-weight: 800;
}
@keyframes bob {
  50% {
    transform: translate(-50%, -5px);
  }
}
.hint .finger {
  display: inline-block;
  margin-right: 8px;
  animation: pull 1.6s ease-in-out infinite;
}
@keyframes pull {
  0%,
  15% {
    transform: translateY(-4px);
    opacity: 1;
  }
  60% {
    transform: translateY(8px);
    opacity: 1;
  }
  75% {
    transform: translateY(8px);
    opacity: 0;
  }
  100% {
    transform: translateY(-4px);
    opacity: 0;
  }
}
/* Power: a paper ruler with a hatched fill. */
.power {
  position: absolute;
  left: 50%;
  bottom: calc(24px + var(--safe-b));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 12px;
  box-shadow: var(--lift);
}
.power .bar {
  position: relative;
  width: min(52vw, 260px);
  height: 16px;
  border-radius: 5px;
  border: 2px solid var(--ink);
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), var(--ink-3) calc(10% - 2px) 10%), var(--paper-2);
  overflow: hidden;
}
.power .bar i {
  display: block;
  height: 100%;
  width: 0;
  background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.28) 0 4px, transparent 4px 8px), linear-gradient(90deg, #3fcf7a, var(--tee) 55%, #ff5a3a);
  background-size: auto, min(52vw, 260px) 100%;
  border-right: 2px solid var(--ink);
}
.power span {
  font-family: var(--display);
  min-width: 48px;
  text-align: right;
}
.power.cancel {
  background-color: #ffe1dc;
}
.power.cancel span {
  color: var(--red);
}
.sling {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.sling.hidden {
  display: none;
}
.sling .band {
  stroke-linecap: round;
  opacity: 0.8;
}
.sling .anchor {
  fill: rgba(255, 244, 220, 0.25);
  stroke-width: 3;
  stroke-dasharray: 5 4;
}
.sling .x path {
  stroke: var(--red);
  stroke-width: 3.5;
  stroke-linecap: round;
  transition: opacity 0.15s;
}
.sling .knob {
  stroke: var(--ink);
  stroke-width: 3;
}
.sling text {
  fill: var(--ink);
  font: 400 15px var(--display);
  paint-order: stroke;
  stroke: var(--paper);
  stroke-width: 5px;
}

/* First-tee coach. */
.coach {
  position: absolute;
  left: 50%;
  top: 56%;
  width: 240px;
  height: 196px;
  transform: translateX(-50%);
  pointer-events: none;
  animation: rise 0.5s both;
}
.coach.hidden {
  display: none;
}
.coach i {
  position: absolute;
  left: 50%;
  font-style: normal;
}
.coach .c-anchor {
  top: 0;
  width: 38px;
  height: 38px;
  margin-left: -19px;
  border-radius: 50%;
  border: 3px dashed var(--paper);
  background: rgba(255, 244, 220, 0.18);
}
.coach .c-band {
  top: 19px;
  width: 6px;
  margin-left: -3px;
  height: 0;
  border-radius: 3px;
  background: var(--tee);
  outline: 2px solid var(--ink);
  animation: coachBand 2.2s ease-in-out infinite;
}
.coach .c-knob {
  top: 6px;
  width: 26px;
  height: 26px;
  margin-left: -13px;
  border-radius: 50%;
  background: var(--tee);
  border: 3px solid var(--ink);
  animation: coachKnob 2.2s ease-in-out infinite;
}
.coach .c-knob span {
  position: absolute;
  left: 14px;
  top: 12px;
  font-size: 30px;
}
.coach p {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 8px 12px;
  border-radius: 12px;
  box-shadow: var(--lift);
  text-align: center;
  font-size: 14px;
  white-space: nowrap;
}
.coach p b {
  font-weight: 800;
}
@keyframes coachKnob {
  0%,
  12% {
    transform: translateY(0);
    opacity: 0;
  }
  18% {
    opacity: 1;
  }
  62% {
    transform: translateY(110px);
    opacity: 1;
  }
  72% {
    transform: translateY(-6px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 0;
  }
}
@keyframes coachBand {
  0%,
  18% {
    height: 0;
  }
  62% {
    height: 110px;
  }
  70%,
  100% {
    height: 0;
  }
}
.ghost-tag {
  position: absolute;
  left: 0;
  top: 0;
  padding: 1px 6px;
  border-radius: 8px;
  background: #dff1ff;
  border: 2px solid var(--ink);
  font-size: 13px;
  pointer-events: none;
  will-change: transform;
}
.ghost-tag.crowd {
  padding: 0 5px;
  border-width: 1.5px;
  background: #eee9ff;
  font-size: 11px;
  font-weight: 700;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.88;
}

/* ── Hole card: a ticket with the world's colour band ─────────────────── */
.card {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translate(-50%, -50%) rotate(-1.5deg);
  width: min(360px, calc(100vw - 32px));
  text-align: center;
  padding: 0 18px 12px;
  border-radius: 16px;
  box-shadow: var(--lift-lg);
  overflow: hidden;
  animation: cardIn 0.5s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}
.card.out {
  animation: cardOut 0.3s ease-in both;
}
@keyframes cardIn {
  from {
    opacity: 0;
    transform: translate(-50%, -60%) rotate(-8deg) scale(0.8);
  }
}
@keyframes cardOut {
  to {
    opacity: 0;
    transform: translate(-50%, -40%) rotate(4deg) scale(0.9);
  }
}
.card .k {
  margin: 0 -18px 12px;
  padding: 7px 10px;
  background: var(--accent);
  border-bottom: 2.5px solid var(--ink);
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.08em;
}
.card .n {
  font-family: var(--display);
  font-size: clamp(26px, 7vw, 36px);
  line-height: 1.05;
  margin: 2px 0 12px;
}
.card .p {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}
.card .p span {
  padding: 4px 10px;
  border-radius: 8px;
  border: 2px solid var(--ink);
  background: var(--paper-2);
  font-weight: 700;
  font-size: 13.5px;
}
.card .p span.sp {
  background: var(--tee);
}
/* Every feature as a punched icon (headline first), the names below. */
.card .ic {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin: -4px 0 10px;
}
.card .ic i {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--paper-2);
  font-style: normal;
  font-size: 17px;
  line-height: 1;
}
.card .ic i:first-child {
  width: 38px;
  height: 38px;
  font-size: 21px;
  box-shadow: 2px 2px 0 var(--ink);
}
.card .ic i.sp {
  background: var(--tee);
}
.card .p span.more {
  border-style: dashed;
  background: transparent;
  color: var(--ink-2);
}
.card .p span.sp::after {
  content: "World special";
  margin-left: 7px;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--ink);
  color: var(--tee);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: 1px;
}
.card .goal {
  margin-top: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 2px dashed var(--gold);
  background: #fff1b8;
  font-size: 13.5px;
  font-weight: 800;
}
.card .skip {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 2px dashed var(--ink-3);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* ── Between holes: the scorecard, marked in pencil ───────────────────── */
.tally {
  position: absolute;
  left: 50%;
  bottom: calc(22px + var(--safe-b));
  width: min(440px, calc(100vw - 24px));
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--lift-lg);
  transform: translate(-50%, 0) rotate(-1deg);
  opacity: 0;
  pointer-events: none;
  background: var(--paper) var(--grain);
  color: var(--ink);
  border: 2.5px solid var(--ink);
}
.tally.show {
  opacity: 1;
  animation: tallyIn 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.tally.out {
  animation: tallyOut 0.36s ease-in both;
}
@keyframes tallyIn {
  from {
    opacity: 0;
    transform: translate(-50%, 70%) rotate(4deg);
  }
}
@keyframes tallyOut {
  to {
    opacity: 0;
    transform: translate(-50%, 60%) rotate(-3deg);
  }
}
.tally .tk {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 14px;
  background: var(--accent);
  border-bottom: 2.5px dashed var(--ink);
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.08em;
}
.tally .tk b {
  font-weight: 400;
}
.tally .tr {
  display: flex;
  align-items: stretch;
  padding: 4px 6px 6px;
}
.tally .tc,
.tally .tt {
  flex: 1;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  padding: 4px 0;
}
.tally .tc + .tc {
  border-left: 2px dashed var(--ink-4);
}
.tally small {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.tally .tc small:last-child {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--ink-3);
}
.tally .mk {
  --mk: 34px;
  font-size: 19px;
}
.tally .tc.todo .mk::before {
  content: "";
  width: 14px;
  border-bottom: 2.5px solid var(--ink-4);
}
.tally .tc.now {
  background: rgba(255, 210, 63, 0.28);
  border-radius: 10px;
}
.tally .tt {
  flex: 1.3;
  margin-left: 4px;
  border-left: 2.5px solid var(--ink);
}
.tally .tt b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 28px;
  line-height: 1;
}
.tally .tt b.under {
  color: var(--green);
}
.tally .tt b.over {
  color: var(--red);
}
.tally .tt b.bump {
  animation: bump 0.45s cubic-bezier(0.3, 1.8, 0.5, 1);
}
@keyframes bump {
  0% {
    transform: scale(1.7) rotate(-8deg);
  }
}
/* The live mark: the number is written, then the ring is drawn round it. */
.mk.pen {
  border: 0;
  outline: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  transform: none;
}
.mk.pen em {
  font-style: normal;
  opacity: 0;
}
.mk.pen svg {
  position: absolute;
  inset: -5px;
  width: calc(100% + 10px);
  height: calc(100% + 10px);
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mk.pen path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}
.write .mk.pen em {
  animation: penWrite 0.28s ease-out both;
}
.write .mk.pen path {
  animation: penDraw 0.42s cubic-bezier(0.5, 0, 0.3, 1) both;
  animation-delay: calc(0.3s + var(--k) * 0.3s);
}
@keyframes penWrite {
  from {
    opacity: 0;
    transform: scale(1.5) rotate(-12deg);
    filter: blur(1px);
  }
  to {
    opacity: 1;
  }
}
@keyframes penDraw {
  to {
    stroke-dashoffset: 0;
  }
}
.mk.pen.ace {
  color: var(--gold);
}
.mk.pen.ace em {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  background: var(--tee);
  color: var(--ink);
}

/* ── The rubber stamp ─────────────────────────────────────────────────── */
.toast {
  z-index: 20; /* (trophy stamps land on top of the results ticket) */
  position: absolute;
  left: 50%;
  top: 37%;
  transform: translate(-50%, -50%) rotate(-7deg);
  opacity: 0;
  text-align: center;
  transition: opacity 0.25s;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  animation: stamp 0.42s cubic-bezier(0.3, 1.7, 0.5, 1) both;
}
@keyframes stamp {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-16deg) scale(2.1);
  }
  55% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(-6deg) scale(0.94);
  }
  100% {
    transform: translate(-50%, -50%) rotate(-7deg) scale(1);
  }
}
.toast .w {
  display: inline-block;
  padding: 6px 20px 2px;
  border: 6px solid currentColor;
  border-radius: 14px;
  background: rgba(255, 244, 220, 0.94);
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(38px, 10vw, 80px);
  line-height: 1.05;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: 0 0 0 3px rgba(255, 244, 220, 0.94), 0 12px 30px rgba(10, 8, 30, 0.35);
}
.toast .s {
  display: table;
  margin: 12px auto 0;
  padding: 5px 14px;
  border-radius: 9px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 0 0 2.5px var(--paper);
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: 0.01em;
}
@media (max-width: 560px) {
  .toast .s {
    max-width: calc(100vw - 48px);
    font-size: 14.5px;
    line-height: 1.3;
  }
}
.toast.under .w {
  color: var(--green);
}
.toast.over .w {
  color: var(--red);
}
.toast.even .w {
  color: var(--ink);
}
.toast.ace .w {
  color: var(--stamp);
  background: var(--tee);
}
.mini {
  position: absolute;
  left: 50%;
  top: calc(96px + var(--safe-t));
  transform: translate(-50%, -8px) rotate(-1deg);
  padding: 6px 14px;
  border-radius: 10px;
  box-shadow: var(--lift);
  font-weight: 800;
  font-size: 14.5px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
}
.mini.show {
  opacity: 1;
  transform: translate(-50%, 0) rotate(-1deg);
}
@media (max-width: 560px) {
  .mini {
    top: calc(118px + var(--safe-t));
  }
}

/* ── Photo mode & replays ─────────────────────────────────────────────── */
.photo-bar {
  position: absolute;
  left: 50%;
  bottom: calc(22px + var(--safe-b));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 8px;
  border-radius: 16px;
  box-shadow: var(--lift);
  pointer-events: auto;
  white-space: nowrap;
}
.photo-bar span {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}
.photo-bar .snap {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--stamp);
  border: 3px solid var(--ink);
  display: grid;
  place-items: center;
  box-shadow: var(--lift);
}
.photo-bar .snap i {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid var(--paper);
}
.photo-bar .snap:active {
  transform: translateY(4px);
  box-shadow: none;
}
@media (max-width: 560px) {
  .photo-bar span {
    display: none;
  }
}
#flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}
#flash.go {
  animation: flash 0.45s ease-out;
}
@keyframes flash {
  from {
    opacity: 0.85;
  }
}
.replay-btn {
  position: absolute;
  left: 50%;
  bottom: calc(26px + var(--safe-b));
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 12px;
  box-shadow: var(--lift);
  font-family: var(--display);
  font-size: 15px;
  animation: rise 0.4s both;
}
#letterbox {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#letterbox.on {
  pointer-events: auto;
}
#letterbox i {
  position: absolute;
  left: 0;
  right: 0;
  height: 11vh;
  background: var(--ink);
  transition: transform 0.45s cubic-bezier(0.3, 0.9, 0.3, 1);
}
#letterbox i:first-child {
  top: 0;
  transform: translateY(-100%);
}
#letterbox i:nth-child(2) {
  bottom: 0;
  transform: translateY(100%);
}
#letterbox.on i {
  transform: none;
}
#letterbox .rec,
#letterbox .skipr {
  position: absolute;
  opacity: 0;
  transition: opacity 0.4s;
  font-family: var(--display);
  letter-spacing: 0.1em;
}
#letterbox .rec {
  top: calc(3.5vh + var(--safe-t));
  left: 20px;
  color: var(--stamp);
}
#letterbox .skipr {
  bottom: 4vh;
  right: 20px;
  font-size: 12px;
  color: var(--paper);
}
#letterbox.on .rec,
#letterbox.on .skipr {
  opacity: 1;
}
#letterbox.on .rec {
  animation: blink 1.2s steps(2) infinite;
}
@keyframes blink {
  50% {
    opacity: 0.35;
  }
}

/* ── Screens ──────────────────────────────────────────────────────────── */
.screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px 16px calc(24px + var(--safe-b));
  background: radial-gradient(ellipse at 50% 55%, rgba(22, 17, 58, 0) 30%, rgba(22, 17, 58, 0.5));
  overflow-y: auto;
}
.title-box,
.res-box {
  position: relative;
  width: min(420px, 100%);
  text-align: center;
  padding: 0 20px 18px;
  border-radius: 18px;
  box-shadow: var(--lift-lg);
  animation: rise 0.6s cubic-bezier(0.2, 1.3, 0.3, 1) both;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
}
/* Punched holes on both edges of the tickets, at the perforation line. */
.title-box::before,
.title-box::after,
.res-box::before,
.res-box::after {
  content: "";
  position: absolute;
  top: 31px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ink);
}
.res-box::before,
.res-box::after {
  top: 52px;
}
.title-box::before,
.res-box::before {
  left: -11px;
}
.title-box::after,
.res-box::after {
  right: -11px;
}

/* Title */
.title-screen {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.title-top {
  text-align: center;
  padding-top: calc(10px + var(--safe-t));
}
.logo {
  margin: 0;
  font: inherit;
  display: inline-flex;
  align-items: flex-start;
  gap: 4px;
  line-height: 0.9;
}
/* Read by search engines and screen readers, not drawn. */
.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.logo span {
  font-family: var(--display);
  font-size: clamp(54px, 15vw, 104px);
  color: var(--paper);
  letter-spacing: 0.01em;
  /* Stacked-ink extrusion, like a painted park sign. */
  text-shadow: 1px 2px 0 var(--ink), 2px 4px 0 var(--ink), 3px 6px 0 var(--ink), 4px 8px 0 var(--accent), 5px 10px 0 var(--ink);
  -webkit-text-stroke: 2px var(--ink);
}
.logo em {
  margin-top: 6px;
  padding: 3px 8px 1px;
  border: 3px solid var(--stamp);
  border-radius: 8px;
  color: var(--stamp);
  background: var(--paper);
  font-family: var(--display);
  font-style: normal;
  font-size: clamp(18px, 4vw, 26px);
  transform: rotate(10deg);
  box-shadow: 0 3px 0 var(--ink);
}
.tag {
  margin: 14px 0 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  color: #fff;
  text-shadow: 0 2px 0 var(--ink), 0 0 16px rgba(22, 17, 58, 0.6);
}
.title-screen .title-box {
  margin-bottom: calc(6px + var(--safe-b));
}
/* The ticket header: ADMIT ONE · No. · world · date. */
.daychip {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin: 0 -20px 16px;
  padding: 10px 14px 11px;
  background: var(--accent);
  border-bottom: 2.5px dashed var(--ink);
  border-radius: 15px 15px 0 0;
  font-weight: 800;
  font-size: 13.5px;
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow: hidden;
}
/* (One line, so the punched holes sit on the perforation: the date goes.) */
#tDate,
.daychip i:last-of-type {
  display: none;
}
#tWorld {
  overflow: hidden;
  text-overflow: ellipsis;
}
.daychip::before {
  content: "ADMIT ONE";
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.12em;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--ink);
  color: var(--paper);
}
.daychip i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink);
}
#tDay {
  font-family: var(--display);
  font-weight: 400;
  font-size: 15px;
}
/* Today's five holes: little stubs. */
.hstrip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin: 0 0 14px;
}
.hstrip:empty {
  display: none;
}
.hchip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 2px 5px;
  border-radius: 10px;
  border: 2px solid var(--ink);
  background: var(--paper-2);
  box-shadow: 0 3px 0 var(--ink);
  animation: rise 0.5s both;
}
.hchip:nth-child(2) {
  animation-delay: 0.05s;
}
.hchip:nth-child(3) {
  animation-delay: 0.1s;
}
.hchip:nth-child(4) {
  animation-delay: 0.15s;
}
.hchip:nth-child(5) {
  animation-delay: 0.2s;
}
.hchip i {
  font-style: normal;
  font-size: 19px;
  line-height: 1.2;
}
.hchip b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 16px;
  line-height: 24px;
}
.hchip small {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  text-transform: uppercase;
}
.hchip.done {
  background: var(--paper);
}
.hchip .mk {
  --mk: 24px;
  font-size: 13px;
  margin: 1px 0;
}
.tgoal {
  position: relative;
  margin: 0 0 12px;
  padding: 9px 12px 9px 44px;
  border-radius: 10px;
  border: 2px dashed var(--gold);
  background: #fff1b8;
  text-align: left;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.35;
}
.tgoal::before {
  content: "🎯";
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 22px;
}
.tgoal span {
  display: block;
  font-family: var(--display);
  font-weight: 400;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: #9a6a00;
}
.tgoal b {
  color: var(--ink);
  white-space: nowrap;
}
.tgoal i {
  font-style: normal;
  color: var(--ink-2);
}
.tgoal.done {
  border-color: var(--green);
  background: #d9f6e4;
}
.rival {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 2px solid var(--blue);
  background: #dff1ff;
  font-size: 13.5px;
  font-weight: 700;
}
/* Halloween week: tonight's haunted night on the title, a violet ticket with a pumpkin rule. */
.rival.night {
  border-color: #ff8a2a;
  background: #2b1350;
  color: #fff4dc;
  box-shadow: inset 0 0 0 2px #1c0d36;
}
.rival.night b {
  color: #ffb45a;
}
/* Fall (1–24 October): a maple-leaf ticket counting down to Halloween week. */
.rival.fall {
  border-color: #d8562a;
  background: #fff0dc;
  color: var(--ink);
}
.rival.fall b {
  color: #b0401a;
}
.whatsnew {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0 0 14px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 2px solid var(--ink);
  background: #ffe3ea;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  animation: rise 0.6s 0.2s both;
}
.whatsnew b {
  flex: none;
  padding: 2px 7px;
  border-radius: 6px;
  border: 2px solid var(--stamp);
  color: var(--stamp);
  background: var(--paper);
  font-family: var(--display);
  font-weight: 400;
  font-size: 11px;
  transform: rotate(-4deg);
}
.whatsnew i {
  margin-left: auto;
  font-style: normal;
  font-size: 20px;
}
.whatsnew.hidden {
  display: none;
}
.stats {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  margin-top: 14px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 2px dashed var(--ink-3);
  cursor: pointer;
  transition: background 0.2s;
}
.stats:hover {
  background: var(--ink-4);
}
.stats:empty {
  display: none;
}
.stats span {
  display: flex;
  flex-direction: column;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 800;
}
.stats b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 21px;
  color: var(--ink);
  letter-spacing: 0;
}
.stats::after {
  content: "📊";
  font-size: 18px;
}
.next {
  margin-top: 12px;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 700;
}
.next b {
  font-family: var(--display);
  font-weight: 400;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
/* Tomorrow's course under the countdown: a stub banded in tomorrow's world colour. */
.tmrw {
  margin-top: 12px;
  padding: 8px 10px 9px 11px;
  border-radius: 10px;
  border: 2px dashed var(--ink-3);
  border-left: 8px solid var(--tacc, var(--accent));
  background: var(--paper-2);
  text-align: left;
}
.tm-k {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-family: var(--display);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.tm-k b {
  font-weight: 400;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.tm-w {
  margin-top: 1px;
  font-size: 14px;
  font-weight: 800;
}
.tm-strip {
  display: flex;
  gap: 6px;
  margin-top: 7px;
}
.tm-strip:empty {
  display: none;
}
.tm-c {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3px 0 2px;
  border-radius: 8px;
  border: 2px solid var(--ink);
  background: var(--paper);
  box-shadow: 0 2px 0 var(--ink);
  animation: rise 0.4s both;
}
.tm-c:nth-child(2) {
  animation-delay: 0.04s;
}
.tm-c:nth-child(3) {
  animation-delay: 0.08s;
}
.tm-c:nth-child(4) {
  animation-delay: 0.12s;
}
.tm-c:nth-child(5) {
  animation-delay: 0.16s;
}
.tm-c i {
  font-style: normal;
  font-size: 17px;
  line-height: 1.25;
}
.tm-c small {
  font-family: var(--display);
  font-size: 11px;
  line-height: 1.1;
  color: var(--ink-2);
}
.tm-par {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 2px 0 3px;
  font-family: var(--display);
  font-size: 16px;
  line-height: 1.1;
}
.tm-par small {
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.tm-remind {
  display: block;
  width: 100%;
  margin-top: 9px;
  padding: 7px 10px;
  border-radius: 9px;
  border: 2px solid var(--ink);
  background: var(--tee);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 800;
  box-shadow: 0 3px 0 var(--ink);
}
.tm-remind:active {
  transform: translateY(3px);
  box-shadow: none;
}
.tm-remind.on {
  border-style: dashed;
  background: var(--paper);
  font-weight: 700;
  box-shadow: none;
}
.tm-remind:disabled {
  opacity: 0.6;
}
.tm-hint {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--ink-2);
}
.title-box .link,
.res-box .link {
  display: block;
  margin: 12px auto 0;
}
.title-box .link.small,
.res-box .link.small {
  margin-top: 8px;
}

/* Results: the scorecard. */
.r-head {
  margin: 0 -20px 14px;
  padding: 11px 14px 12px;
  background: var(--accent);
  border-bottom: 2.5px dashed var(--ink);
  border-radius: 15px 15px 0 0;
  font-family: var(--display);
  font-size: 16px;
  letter-spacing: 0.04em;
}
.r-world {
  margin-top: 2px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}
.big {
  display: inline-block;
  font-family: var(--display);
  font-size: clamp(64px, 18vw, 96px);
  line-height: 1;
  padding: 2px 18px 0;
  border: 5px solid currentColor;
  border-radius: 16px;
  transform: rotate(-4deg);
  margin: 2px 0 10px;
  animation: stampIn 0.45s 0.2s cubic-bezier(0.3, 1.7, 0.5, 1) both;
}
@keyframes stampIn {
  from {
    opacity: 0;
    transform: rotate(-14deg) scale(1.9);
  }
}
.big.under {
  color: var(--green);
}
.big.over {
  color: var(--red);
}
.big.even {
  color: var(--ink);
}
.verdict {
  color: var(--ink-2);
  font-weight: 700;
  margin-bottom: 14px;
  font-size: 14.5px;
}
.rcard {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin-bottom: 12px;
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  overflow: hidden;
  background: #fffaf0;
}
.hc {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 2px 6px;
  animation: rise 0.5s both;
}
.hc + .hc {
  border-left: 2px solid var(--ink);
}
.hc:nth-child(2) {
  animation-delay: 0.06s;
}
.hc:nth-child(3) {
  animation-delay: 0.12s;
}
.hc:nth-child(4) {
  animation-delay: 0.18s;
}
.hc:nth-child(5) {
  animation-delay: 0.24s;
}
.hc .hn {
  align-self: stretch;
  padding: 3px 0;
  border-bottom: 2px solid var(--ink);
  background: var(--paper-2);
  font-family: var(--display);
  font-size: 12px;
}
.hc .hs {
  line-height: 1.1;
}
.hc .hs .mk {
  --mk: 34px;
  margin: 7px 0 3px;
  font-size: 19px;
}
.hc .hp {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-2);
}
.hc .hg {
  position: absolute;
  top: 24px;
  right: 3px;
  font-size: 13px;
}
.hc.ace {
  background: #fff4c2;
}
.rgems {
  margin-bottom: 14px;
  font-weight: 800;
  font-size: 14px;
}
.rgems .nudge {
  display: block;
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
}
.rgems .nudge.won {
  color: #9a6a00;
}
.nudge.race {
  display: block;
  margin: 0 0 8px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 2px solid var(--blue);
  background: #dff1ff;
  font-size: 13.5px;
  color: var(--ink);
}
.nudge.goal {
  display: block;
  margin: 0 0 8px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 2px dashed var(--gold);
  background: #fff1b8;
  font-size: 13.5px;
  color: var(--ink);
}
.nudge.goal.ok {
  border-color: var(--green);
  background: #d9f6e4;
}
.rtour {
  margin: -4px 0 12px;
}
.rtour .stars {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 4px;
}
.rtour .stars i {
  font-style: normal;
  font-size: 40px;
  line-height: 1;
  color: var(--ink-4);
  -webkit-text-stroke: 2px var(--ink-3);
}
.rtour .stars i.on {
  color: var(--tee);
  -webkit-text-stroke: 2px var(--ink);
  animation: starPop 0.5s cubic-bezier(0.2, 1.8, 0.4, 1) both;
}
.rtour .stars i:nth-child(2) {
  font-size: 52px;
  transform: translateY(-6px);
}
@keyframes starPop {
  from {
    opacity: 0;
    transform: scale(0.2) rotate(-40deg);
  }
}
.rtour .stars i:nth-child(2).on {
  animation-name: starPop2;
}
@keyframes starPop2 {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.2) rotate(-40deg);
  }
  to {
    transform: translateY(-6px);
  }
}
.rtour small {
  display: block;
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 700;
}
.rtour .unl {
  margin-top: 4px;
  color: var(--blue);
}

/* ── Modals: sheets slid across the counter ───────────────────────────── */
.modal {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(22, 17, 58, 0.55);
  animation: fade 0.2s both;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.panel {
  width: min(380px, 100%);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 18px 18px;
  border-radius: 18px;
  box-shadow: var(--lift-lg);
  display: grid;
  gap: 10px;
  animation: rise 0.4s cubic-bezier(0.2, 1.2, 0.3, 1) both;
}
.panel h3 {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 -18px 4px;
  padding: 12px 14px;
  background: var(--accent);
  border-bottom: 2.5px dashed var(--ink);
  font-family: var(--display);
  font-weight: 400;
  font-size: 20px;
  letter-spacing: 0.03em;
  text-align: center;
}
.panel.locker,
.panel.statsp,
.panel.how {
  width: min(470px, 100%);
}

/* ── Share sheet: the card on the counter before it goes out ──────────── */
.panel.sharep {
  width: min(440px, 100%);
}
/* Sized by its shape (--ar, set from main.js): as wide as the sheet, but
   never taller than about half the screen. */
.sh-prev {
  --ar: 1;
  --prev-h: min(44vh, 440px);
  position: relative;
  justify-self: center;
  width: min(100%, calc(var(--prev-h) * var(--ar)));
  aspect-ratio: var(--ar);
  margin-top: 4px;
  border-radius: 12px;
  border: 2.5px solid var(--ink);
  box-shadow: var(--lift);
  overflow: hidden;
  background: repeating-linear-gradient(-45deg, var(--paper-2) 0 10px, var(--paper-3) 10px 20px);
}
.sh-prev img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.sh-prev img:not([src]) {
  visibility: hidden;
}
.sh-prev img.in {
  animation: develop 0.5s ease-out both;
}
@keyframes develop {
  from {
    opacity: 0;
    filter: brightness(1.8) saturate(0.2);
  }
}
.sh-dev {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 15px;
  color: var(--ink-2);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.sh-prev.busy .sh-dev {
  opacity: 1;
}
.sh-prev.busy img {
  opacity: 0;
}
.sh-fmts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.sh-fmts button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 2.5px solid var(--ink);
  background: var(--paper);
  box-shadow: 0 3px 0 var(--ink);
  font-family: var(--display);
  font-size: 13px;
  color: var(--ink);
}
.sh-fmts button i {
  display: block;
  border: 2px solid currentColor;
  border-radius: 3px;
}
.sh-fmts button.on {
  background: var(--accent);
  transform: translateY(3px);
  box-shadow: 0 0 0 var(--ink);
}
.sh-text {
  border: 2px dashed var(--ink-3);
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--ink);
}
.sh-text summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 14px;
}
.sh-text pre {
  margin: 8px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: 600 13px/1.45 var(--font);
  user-select: text;
  -webkit-user-select: text;
}
.sh-note {
  min-height: 1.2em;
  margin: 0;
  text-align: center;
  font-weight: 800;
  font-size: 14px;
  color: var(--green);
}
.panel.sharep .link {
  justify-self: center;
}
/* ── Hole Builder ─────────────────────────────────────────────────────── */
.panel.buildp {
  width: min(560px, 100%);
}
.bd-worlds {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.bd-worlds button {
  padding: 4px 10px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--paper-2);
  color: var(--ink);
  font-weight: 800;
  font-size: 13px;
}
.bd-worlds button.on {
  background: var(--tee);
  box-shadow: 0 2px 0 var(--ink);
}
.bd-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 10px;
  align-items: start;
}
@media (max-width: 520px) {
  .bd-main {
    grid-template-columns: 1fr;
  }
}
.bd-plan {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  border: 2.5px solid var(--ink);
  background: #2a2350;
}
.bd-steps {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 34px;
}
.bd-steps li {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px 3px 9px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}
.bd-steps li.turn {
  background: #e4f0ff;
}
.bd-steps li.dress {
  background: #eaf7dc;
}
.bd-steps li button {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  line-height: 20px;
}
.bd-add {
  display: grid;
  gap: 6px;
}
.bd-sel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 800;
  font-size: 13.5px;
  color: var(--ink);
}
.bd-sel select,
#bdName {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border-radius: 10px;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}
.bd-turns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.bd-turns button.ghost {
  min-height: 38px;
  font-size: 13px;
  padding: 6px;
}

/* The highlight clip: 9:16, recorded live in the sheet, then played back.
   (The stage renders the 9:16 frame meanwhile, stretched: keep it out of sight.) */
#clipM {
  background: rgba(14, 10, 40, 0.94);
}
.cl-prev {
  --ar: 0.5625;
  --prev-h: min(56vh, 560px);
  background: #16113a;
}
.cl-prev canvas,
.cl-prev video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ── Feedback: the comment card left at the counter ───────────────────── */
.panel.fbp {
  width: min(420px, 100%);
}
.fb-kinds {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.fb-kinds button {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-height: 54px;
  padding: 6px 4px;
  border-radius: 10px;
  border: 2.5px solid var(--ink);
  background: var(--paper);
  box-shadow: 0 3px 0 var(--ink);
  font-family: var(--display);
  font-size: 11.5px;
  color: var(--ink);
}
.fb-kinds button i {
  font-style: normal;
  font-size: 20px;
  line-height: 1.1;
}
.fb-kinds button.on {
  background: var(--accent);
  transform: translateY(3px);
  box-shadow: 0 0 0 var(--ink);
}
/* 16px so iOS doesn't zoom the page on focus. */
.fbp textarea,
.fbp input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 11px;
  border: 2.5px solid var(--ink);
  background: #fffaf0;
  color: var(--ink);
  font: 600 16px/1.4 var(--font);
  user-select: text;
  -webkit-user-select: text;
}
.fbp textarea {
  min-height: 112px;
  resize: vertical;
}
.fbp textarea::placeholder,
.fbp input::placeholder {
  color: var(--ink-3);
}
.fbp textarea:focus,
.fbp input:focus {
  outline: 3px solid var(--blue);
  outline-offset: 1px;
}
.fb-ctx {
  margin: 0;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}
.fbp button.primary:disabled {
  opacity: 0.6;
  cursor: progress;
}
.fbp .sh-note.err {
  color: var(--red);
}
.fbp .sh-note:empty {
  display: none;
}
.panel.fbp .link {
  justify-self: center;
}
@media (max-height: 700px) {
  .sh-prev {
    --prev-h: 38vh;
  }
}
.sel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sel select {
  font: 700 15px var(--font);
  background: var(--paper-2);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 4px 8px;
}
.lk-sec {
  margin-top: 6px;
  font-family: var(--display);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.lk-sec::after {
  content: "";
  flex: 1;
  border-top: 2px dashed var(--ink-3);
}
.lk-sec span {
  font-family: var(--font);
  font-weight: 800;
  letter-spacing: 0;
}

/* World Tour picker: world cards like trading cards. */
.pk-sub {
  margin: 0;
  text-align: center;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--ink-2);
}
.pk-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.pk-grid button {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 10px 11px;
  border-radius: 12px;
  border: 2.5px solid var(--ink);
  box-shadow: var(--lift);
  text-align: left;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  text-shadow: 0 1.5px 0 var(--ink);
  transition: transform 0.08s, box-shadow 0.08s;
}
.pk-grid button:active {
  transform: translateY(4px);
  box-shadow: none;
}
.pk-grid button i {
  font-style: normal;
  font-size: 24px;
}
.pk-grid button span {
  min-width: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: 12.5px;
  line-height: 1.15;
  padding-right: 34px;
}
.pk-grid button small {
  display: block;
  margin-top: 2px;
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 700;
}
.pk-grid button em {
  display: inline-block;
  margin-top: 5px;
  padding: 1px 7px;
  border-radius: 6px;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  text-shadow: none;
  font-family: var(--font);
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pk-stars {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 1px 6px;
  border-radius: 6px;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  text-shadow: none;
  font-size: 11px;
  font-weight: 800;
}
.pk-stars.full {
  background: var(--tee);
}
.pk-grid.sheet {
  grid-template-columns: 1fr;
}
.pk-world {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 2.5px solid var(--ink);
  box-shadow: var(--lift);
  animation: rise 0.35s both;
}
.pk-grid .pk-back {
  justify-self: start;
  display: block;
  padding: 3px 10px;
  border-radius: 8px;
  border: 2px solid var(--ink);
  background: var(--paper);
  box-shadow: none;
  color: var(--ink);
  text-shadow: none;
  font-weight: 800;
  font-size: 13px;
}
.pk-wh {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  color: #fff;
  text-shadow: 0 1.5px 0 var(--ink);
}
.pk-wh i {
  font-style: normal;
  font-size: 32px;
}
.pk-wh b {
  display: block;
  font-family: var(--display);
  font-weight: 400;
  font-size: 19px;
}
.pk-wh small {
  font-size: 12px;
  font-weight: 800;
}
.pk-wh span {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 7px;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  text-shadow: none;
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
}
.pk-courses {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.pk-grid .pk-course {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 4px 9px;
  background: var(--paper) var(--grain);
  color: var(--ink);
  text-shadow: none;
  text-align: center;
}
.pk-course b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 13px;
}
.pk-course em {
  font-style: normal;
  font-size: 21px;
  letter-spacing: 1px;
  color: var(--ink-3);
}
.pk-course em i {
  font-style: normal;
  color: var(--tee);
  -webkit-text-stroke: 1.5px var(--ink);
}
.pk-course small {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-2);
}
.pk-course.locked {
  background: var(--paper-3);
  opacity: 0.75;
}
.pk-grid .pk-rand {
  justify-content: center;
  background: var(--paper) var(--grain);
  color: var(--ink);
  text-shadow: none;
  font-size: 14.5px;
}
.panel.pick .link {
  margin-top: 0;
}
/* Past dailies: a paper button over the worlds, and a sheet of days. */
.pk-grid .pk-pastbtn,
.pk-past {
  grid-column: 1 / -1;
  background: var(--paper) var(--grain);
  color: var(--ink);
  text-shadow: none;
}
.pk-past .pk-wh {
  color: var(--ink);
  text-shadow: none;
}
.pk-days {
  display: grid;
  gap: 7px;
}
.pk-grid .pk-day {
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-width: 2px;
  box-shadow: 0 3px 0 var(--ink);
  background: var(--paper-2);
  color: var(--ink);
  text-shadow: none;
}
.pk-grid .pk-day:active {
  transform: translateY(3px);
}
.pk-day b {
  min-width: 42px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 14px;
}
.pk-grid .pk-day i {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 2px solid var(--ink);
  font-size: 16px;
}
.pk-grid .pk-day span {
  flex: 1;
  padding-right: 0;
  font-size: 12px;
}
.pk-grid .pk-day small {
  color: var(--ink-2);
}
.pk-grid .pk-day em {
  margin: 0;
  flex: none;
  text-align: right;
  white-space: normal;
  line-height: 1.25;
  border-width: 0;
  background: none;
  padding: 0;
  color: var(--ink-2);
}
.rpast {
  margin: -4px 0 12px;
  display: grid;
  gap: 3px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}
.rpast b {
  color: var(--ink);
}
.rpast .pf:empty {
  display: none;
}

/* Locker */
.lk-bank {
  text-align: center;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-2);
}
.lk-bank b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 18px;
  color: var(--ink);
}
.lk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}
.lk-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px 8px;
  border-radius: 12px;
  border: 2px solid var(--ink);
  background: var(--paper-2);
  box-shadow: 0 3px 0 var(--ink);
  color: var(--ink);
  transition: transform 0.08s, box-shadow 0.08s;
}
.lk-item:active {
  transform: translateY(3px);
  box-shadow: none;
}
.lk-item img {
  width: 56px;
  height: 56px;
}
.lk-item span {
  font-size: 13px;
  font-weight: 800;
}
.lk-item em {
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-2);
}
.lk-item.on {
  background: var(--tee);
}
.lk-item.on em {
  color: var(--ink);
}
.lk-item.locked {
  background: var(--paper-3);
}
.lk-item.locked img {
  filter: grayscale(1) brightness(0.55);
}
.lk-item.fresh::after,
.tr-item.fresh::after {
  content: "NEW";
  position: absolute;
  top: -7px;
  right: -5px;
  padding: 1px 5px;
  border-radius: 5px;
  border: 2px solid var(--stamp);
  background: var(--paper);
  color: var(--stamp);
  font-family: var(--display);
  font-size: 9.5px;
  transform: rotate(8deg);
}
.lk-item u {
  display: block;
  width: 72%;
  height: 7px;
  margin: 5px auto 0;
  border-radius: 4px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  overflow: hidden;
  position: relative;
}
.lk-item u::after {
  content: "";
  position: absolute;
  inset: 0;
  width: calc(var(--p) * 100%);
  background: var(--tee);
  border-right: 1.5px solid var(--ink);
}
.tr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  gap: 8px;
}
.tr-item {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto auto;
  column-gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  border: 2px dashed var(--ink-3);
  background: var(--paper-2);
  color: var(--ink);
}
.tr-item i {
  grid-row: 1 / 4;
  font-style: normal;
  font-size: 24px;
  filter: grayscale(1) opacity(0.4);
}
.tr-item span {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-2);
}
.tr-item em {
  font-style: normal;
  font-size: 11px;
  line-height: 1.25;
  color: var(--ink-2);
}
.tr-item b {
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-3);
}
.tr-item.got {
  border: 2px solid var(--ink);
  background: #fff1b8;
  box-shadow: 0 3px 0 var(--ink);
}
.tr-item.got i {
  filter: none;
}
.tr-item.got span {
  color: var(--ink);
}
.tr-item.got b {
  color: #9a6a00;
}

/* How to play */
.how ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}
.how li {
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-2);
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--paper-2);
}
.how li b {
  color: var(--ink);
  font-weight: 800;
}
:is(.how, .welcome) .steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
:is(.how, .welcome) .steps div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 12px 6px 10px;
  border-radius: 12px;
  border: 2px solid var(--ink);
  background: var(--paper-2);
  box-shadow: 0 3px 0 var(--ink);
  text-align: center;
  animation: rise 0.5s both;
}
:is(.how, .welcome) .steps div:nth-child(2) {
  animation-delay: 0.08s;
}
:is(.how, .welcome) .steps div:nth-child(3) {
  animation-delay: 0.16s;
}
:is(.how, .welcome) .steps i {
  font-style: normal;
  font-size: 30px;
  line-height: 1.2;
}
:is(.how, .welcome) .steps .st-a {
  animation: pullDemo 1.8s ease-in-out infinite;
}
@keyframes pullDemo {
  0%,
  20% {
    transform: translateY(-4px);
  }
  60% {
    transform: translateY(9px);
  }
  70% {
    transform: translateY(-8px) scale(1.1);
  }
  100% {
    transform: translateY(-4px);
  }
}
:is(.how, .welcome) .steps b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 13px;
}
:is(.how, .welcome) .steps small {
  font-size: 11.5px;
  line-height: 1.3;
  font-weight: 600;
  color: var(--ink-2);
}
.how .look {
  margin: 6px 2px 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  text-align: center;
}
.how details {
  border-radius: 10px;
  border: 2px solid var(--ink);
  background: var(--paper);
}
.how summary {
  padding: 10px 12px;
  font-weight: 800;
  font-size: 14.5px;
  cursor: pointer;
  list-style: none;
}
.how summary::-webkit-details-marker {
  display: none;
}
.how summary::after {
  content: "›";
  float: right;
  font-size: 20px;
  line-height: 1;
  transition: transform 0.2s;
}
.how details[open] summary::after {
  transform: rotate(90deg);
}
.how details ul {
  padding: 0 8px 8px;
}
.keys {
  margin: 2px 0 4px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}

/* Stats */
.st-tiles {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  text-align: center;
  border: 2px solid var(--ink);
  border-radius: 10px;
  overflow: hidden;
  background: #fffaf0;
}
.st-tiles span {
  display: flex;
  flex-direction: column;
  padding: 6px 2px;
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 800;
}
.st-tiles span + span {
  border-left: 2px dashed var(--ink-3);
}
.st-tiles b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 20px;
  color: var(--ink);
  letter-spacing: 0;
}
.st-dist {
  display: grid;
  gap: 3px;
}
.st-dist .row {
  display: grid;
  grid-template-columns: 34px 1fr 70px;
  align-items: center;
  gap: 6px;
  height: 18px;
}
.st-dist i {
  font-style: normal;
  font-family: var(--display);
  font-size: 12px;
  color: var(--ink-2);
  text-align: right;
}
.st-dist u {
  display: block;
  height: 13px;
  width: var(--w);
  border-radius: 0 4px 4px 0;
  background: var(--ink);
}
.st-dist b {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink);
}
.st-dist .row.me u {
  background: var(--tee);
  outline: 2px solid var(--ink);
  outline-offset: -2px;
}
.st-dist em {
  font-style: normal;
  font-weight: 800;
  color: #9a6a00;
}
.st-empty {
  margin: 4px 0;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}
.st-cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.st-cal .c {
  display: grid;
  place-items: center;
  height: 30px;
  border-radius: 6px;
  border: 1.5px solid var(--ink-3);
  background: var(--paper-2);
  font-family: var(--display);
  font-size: 11px;
  color: var(--ink);
}
.st-cal button.c:active {
  transform: translateY(1px);
}
.st-cal button.c:hover {
  border-color: var(--ink);
}
.st-cal .under {
  background: #bdeccd;
  border-color: var(--green);
}
.st-cal .even {
  background: var(--paper);
  border-color: var(--ink-2);
}
.st-cal .over {
  background: #ffd2c9;
  border-color: var(--red);
}
.st-cal .today {
  border: 2px dashed var(--ink);
}
.st-holes {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  text-align: center;
}
.st-holes span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.st-holes .mk.sm {
  --mk: 32px;
  font-size: 14px;
  margin: 4px 0;
}
.st-holes small {
  font-size: 10px;
  color: var(--ink-2);
  font-weight: 800;
}
.st-worlds {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.st-worlds div {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 2px solid var(--ink);
  box-shadow: 0 3px 0 var(--ink);
  color: #fff;
  text-shadow: 0 1.5px 0 var(--ink);
}
.st-worlds i {
  font-style: normal;
  font-size: 20px;
}
.st-worlds span {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.15;
}
.st-worlds small {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
}
.st-worlds b {
  margin-left: auto;
  font-family: var(--display);
  font-weight: 400;
  font-size: 16px;
}

/* ── Loading ──────────────────────────────────────────────────────────── */
#loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background: var(--ink) var(--grain);
  color: var(--paper);
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: 0.08em;
  transition: opacity 0.6s;
  pointer-events: auto;
}
#loading.done {
  opacity: 0;
  pointer-events: none;
}
#loading .logo span {
  font-size: clamp(44px, 12vw, 72px);
}
#loading .logo em {
  font-size: clamp(15px, 3.4vw, 20px);
}
#loading .msg {
  opacity: 0.8;
  text-align: center;
}
/* A golf ball bouncing on the spot, its shadow breathing under it. */
.spin {
  position: relative;
  width: 34px;
  height: 58px;
  margin-top: 10px;
}
.spin::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 0;
  height: 7px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  animation: hopShadow 0.7s cubic-bezier(0.5, 0, 0.5, 1) infinite alternate;
}
.spin i {
  position: absolute;
  left: 0;
  bottom: 4px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #e8e2d0 70%);
  border: 3px solid var(--paper);
  box-shadow: 0 0 0 3px var(--ink);
  transform-origin: 50% 100%;
  animation: hop 0.7s cubic-bezier(0.5, 0, 0.5, 1) infinite alternate;
}
@keyframes hop {
  from {
    transform: translateY(-24px);
  }
  90% {
    transform: translateY(0) scale(1);
  }
  to {
    transform: translateY(0) scale(1.12, 0.84);
  }
}
@keyframes hopShadow {
  from {
    transform: scale(0.45);
    opacity: 0.4;
  }
  to {
    transform: scale(1.1);
    opacity: 1;
  }
}
#loading a {
  color: var(--tee);
}
/* No WebGL 2: the way on to PUTTLE Classic is a ticket to press, not a
   redirect (main.js, the catch round `new Stage`). */
#loading a.nogl-go {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 12px 22px;
  border-radius: 14px;
  border: 2.5px solid var(--ink);
  box-shadow: 0 4px 0 #000;
  background: var(--tee);
  color: var(--ink);
  font-size: 17px;
  letter-spacing: 0.02em;
  text-decoration: none;
}
#loading a.nogl-go:active {
  transform: translateY(4px);
  box-shadow: none;
}

/* ── Leaderboard: the clubhouse chalkboard, on paper ──────────────────── */
.rsocial {
  display: block;
  width: 100%;
  margin: -2px 0 12px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 2px solid var(--ink);
  background: #e4f0ff;
  color: var(--ink);
  font-weight: 700;
  font-size: 13.5px;
  box-shadow: 0 3px 0 var(--ink);
  animation: rise 0.4s both;
}
.rsocial i {
  float: right;
  font-style: normal;
  font-family: var(--display);
}
.rsocial:active {
  transform: translateY(3px);
  box-shadow: none;
}
/* Rivals on the results ticket: how today went against each, and the tally. */
.rsocial.rrivals {
  background: #f1e8ff;
  box-shadow: none;
  text-align: center;
}
.rsocial.rrivals:active {
  transform: none;
}
.rsocial.rrivals i,
.rival i {
  float: none;
  font-family: inherit;
  font-style: italic;
  font-weight: 600;
  color: var(--ink-2);
}
.panel.lbp {
  width: min(420px, 100%);
}
.lb-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  overflow: hidden;
}
.lb-tabs button {
  padding: 9px 6px;
  font-weight: 800;
  font-size: 14px;
  background: var(--paper-2);
}
.lb-tabs button + button {
  border-left: 2.5px solid var(--ink);
}
.lb-tabs button.on {
  background: var(--tee);
}
.lb-sub,
.lb-you {
  margin: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}
.lb-you:empty {
  display: none;
}
.lb-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  background: #fffaf0;
  overflow: hidden;
}
.lb-list:empty {
  display: none;
}
.lb-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  font-weight: 700;
  font-size: 14px;
}
.lb-list li + li {
  border-top: 2px dashed var(--ink-4);
}
.lb-list li.me {
  background: rgba(255, 210, 63, 0.35);
}
.lb-list .r {
  min-width: 28px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 13px;
}
/* A long name wraps rather than trailing off: everyone's name is read in full. */
.lb-list .n {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.2;
}
.lb-list b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 15px;
}
.lb-list b small {
  font-family: var(--font);
  font-weight: 800;
  font-size: 12px;
}
.lb-list b.under small {
  color: var(--green);
}
.lb-list b.over small {
  color: var(--red);
}
.lb-list .lb-empty {
  justify-content: center;
  color: var(--ink-2);
}
.lb-crew {
  display: grid;
  gap: 8px;
}
.lb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.lb-chips:empty {
  display: none;
}
.lb-chips button {
  padding: 5px 11px;
  border-radius: 9px;
  border: 2px solid var(--ink);
  background: var(--paper-2);
  font-weight: 800;
  font-size: 13px;
}
.lb-chips button.on {
  background: var(--tee);
  box-shadow: 0 2px 0 var(--ink);
}
.lb-row {
  display: flex;
  gap: 8px;
}
.lb-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 11px;
  border: 2.5px solid var(--ink);
  background: #fffaf0;
  color: var(--ink);
  font: 700 15px var(--font);
  user-select: text;
  -webkit-user-select: text;
}
.lb-row input:focus {
  outline: 3px solid var(--blue);
  outline-offset: 1px;
}
.lb-row button.ghost {
  width: auto;
  min-height: 0;
  padding: 8px 16px;
  font-size: 15px;
}
/* The Weekly Open: a Today / Week switch under the tabs, a week stepper, and
   each row's seven-day strip (Monday first). */
.lb-span {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.lb-span button {
  padding: 6px;
  border-radius: 9px;
  border: 2px solid var(--ink);
  background: var(--paper-2);
  font-weight: 800;
  font-size: 13px;
}
.lb-span button.on {
  background: var(--tee);
  box-shadow: 0 2px 0 var(--ink);
}
.lb-weeknav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lb-weeknav span {
  flex: 1;
  text-align: center;
  font-family: var(--display);
  font-size: 13px;
}
.lb-weeknav button {
  width: 34px;
  height: 30px;
  border-radius: 9px;
  border: 2px solid var(--ink);
  background: var(--paper-2);
  font-family: var(--display);
  font-size: 18px;
  line-height: 1;
}
.lb-weeknav button:disabled {
  opacity: 0.3;
  cursor: default;
}
.lb-rule {
  margin: 0;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}
.pips {
  display: inline-flex;
  flex: none;
  gap: 2px;
  vertical-align: middle;
}
.pips i {
  width: 8px;
  height: 11px;
  border-radius: 2px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
}
.pips i.u {
  background: var(--green);
}
.pips i.o {
  background: var(--red);
}
.pips i.e {
  background: var(--tee);
}
.pips i.m {
  border-style: dashed;
  border-color: var(--ink-3);
  background: transparent;
}
.pips i.t {
  border-style: dashed;
  background: #fff;
}
.pips i.f {
  border-color: var(--ink-4);
  background: transparent;
}
.lb-list li.wk .pips {
  margin-right: 2px;
}
.lb-list li.wk b {
  min-width: 30px;
  text-align: right;
}
.rsocial.rweek {
  background: #fff1c2;
}
.rsocial.rweek .pips {
  margin-left: 4px;
}
.week-note {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 9px;
  border: 2px solid var(--gold);
  background: #fff1c2;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}
.week-note b {
  font-family: var(--display);
  font-weight: 400;
}
.week-note i {
  margin-left: 6px;
  font-style: normal;
  font-family: var(--display);
}
.atlas-note {
  border-color: var(--ink-3);
  background: #e8f4ff;
}

/* ── Sky Atlas: your finished dailies as islands in the sky ──────────── */
.atlas {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.at-top {
  position: absolute;
  top: calc(12px + var(--safe-t));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}
.at-t {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 7px 18px 8px;
  border-radius: 14px;
  background: var(--paper) var(--grain);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  box-shadow: var(--lift);
}
.at-t b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 20px;
  letter-spacing: 0.03em;
}
.at-t small {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
}
.at-top .icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--paper) var(--grain);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  box-shadow: var(--lift);
  display: grid;
  place-items: center;
}
.at-top .icon svg {
  width: 22px;
  height: 22px;
}
.at-card {
  position: absolute;
  left: 50%;
  bottom: calc(18px + var(--safe-b));
  transform: translateX(-50%);
  width: min(360px, calc(100vw - 24px));
  border-radius: 16px;
  background: var(--paper) var(--grain);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  box-shadow: var(--lift-lg);
  overflow: hidden;
  pointer-events: auto;
  animation: at-in 0.28s cubic-bezier(0.2, 1.4, 0.4, 1);
}
@keyframes at-in {
  from {
    transform: translate(-50%, 24px);
    opacity: 0;
  }
}
.at-card .at-band {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 8px 14px 7px;
  background: var(--at-acc, var(--accent));
  border-bottom: 2.5px dashed var(--ink);
  font-family: var(--display);
  font-size: 15px;
}
.at-card .at-band small {
  font-family: var(--font);
  font-weight: 700;
  font-size: 12.5px;
}
.at-card .at-body {
  padding: 10px 14px 12px;
  display: grid;
  gap: 8px;
}
.at-card .at-score {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}
.at-card .at-score .at-big {
  font-family: var(--display);
  font-size: 26px;
  line-height: 1;
}
.at-card .at-score .at-big.under {
  color: var(--green);
}
.at-card .at-score .at-big.over {
  color: var(--red);
}
.at-card .at-marks {
  display: flex;
  gap: 4px;
}
.at-card p {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.at-card button.ghost,
.at-card button.primary {
  min-height: 44px;
  font-size: 15px;
}
.at-hint {
  position: absolute;
  left: 50%;
  bottom: calc(18px + var(--safe-b));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 28px);
  margin: 0;
  padding: 7px 14px;
  border-radius: 12px;
  background: var(--paper) var(--grain);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  box-shadow: var(--lift);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}
.at-card:not(.hidden) ~ .at-hint {
  display: none;
}

.lbp button.ghost#lbInvite {
  min-height: 44px;
  font-size: 15px;
}

/* ── Welcome: a classic player's first PUTTLE 3D ─────────────────────── */
.panel.welcome {
  width: min(440px, 100%);
  text-align: center;
}
.wl-lede {
  margin: 4px 0 0;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.4;
}
.wl-carry {
  padding: 10px 10px 12px;
  border: 2.5px dashed var(--green);
  border-radius: 12px;
  background: #d9f6e4;
}
.wl-carry small {
  display: block;
  margin-bottom: 6px;
  font-family: var(--display);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: var(--green);
}
.wl-carry div {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  font-size: 14.5px;
}
.welcome .link.small {
  justify-self: center;
}
.streak-note {
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 9px;
  border: 2px dashed #7fb8ff;
  background: #e4f0ff;
  color: var(--ink);
  font-size: 13px;
}
/* Three buttons in a row on the title (World Tour, Locker, Board). */
.title-box .btn-row:has(> :nth-child(3):not(.hidden)) button.ghost {
  font-size: 13.5px;
  padding-left: 4px;
  padding-right: 4px;
}

/* Tall tickets never clip: centred while they fit, top-aligned and
   scrollable when they don't (auto margins give way instead of overflowing
   off the top). */
#results > .res-box {
  margin-block: auto;
}
/* Short screens (a laptop with its browser chrome, a phone in landscape):
   the same tickets, pressed a little tighter. */
@media (max-height: 860px) {
  .logo span {
    font-size: clamp(48px, 11vh, 84px);
  }
  .tag {
    margin-top: 8px;
    font-size: 14px;
  }
  .title-screen {
    gap: 10px;
    padding-top: 14px;
    padding-bottom: calc(14px + var(--safe-b));
  }
  .daychip {
    margin-bottom: 12px;
  }
  .hstrip {
    margin-bottom: 10px;
  }
  button.primary,
  button.ghost {
    min-height: 48px;
    padding-top: 9px;
    padding-bottom: 9px;
  }
  .btn-row button.ghost {
    min-height: 42px;
  }
  .btns {
    gap: 8px;
  }
  .stats {
    margin-top: 10px;
    padding: 6px 10px;
  }
  #results {
    padding-top: 14px;
    padding-bottom: calc(14px + var(--safe-b));
  }
  .big {
    font-size: clamp(52px, 10vh, 80px);
    margin-bottom: 6px;
  }
  .verdict {
    margin-bottom: 10px;
  }
  .rgems {
    margin-bottom: 10px;
  }
}
@media (max-height: 700px) {
  .tag {
    display: none;
  }
  .logo span {
    font-size: clamp(40px, 9vh, 64px);
  }
  .title-box .link.small {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
@media (max-width: 440px) {
  .pk-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .pk-grid button span {
    font-size: 14px;
  }
}

/* "What is PUTTLE?" — the plain-words brief and the site's pages, folded
   away at the foot of the title ticket. */
.title-about {
  margin-top: 8px;
  text-align: left;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-2);
}
.title-about summary {
  cursor: pointer;
  text-align: center;
  font-weight: 700;
  font-size: 12.5px;
  list-style: none;
}
.title-about summary::-webkit-details-marker {
  display: none;
}
.title-about summary::after {
  content: " ▾";
}
.title-about[open] summary::after {
  content: " ▴";
}
.title-about p {
  margin: 8px 0 0;
}
.title-seo-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 2px dashed var(--ink-4);
}
.title-seo-links a {
  color: var(--ink);
  font-weight: 700;
}

/* ── Live 1v1: the orange side of the counter ─────────────────────────── */
:root {
  --opp: #ff7a2e;
  --opp-paper: #ffe6cc;
}
button.battle-btn {
  background: var(--opp-paper);
  min-height: 48px;
  font-size: 15px;
}
.stat.battle {
  background: var(--opp-paper);
}
.stat.battle span {
  font-size: 12px;
  letter-spacing: 0;
}
.stat.battle b {
  color: #b64a0c;
}
.stat.battle b.under {
  color: var(--green);
}
.stat.battle b.over {
  color: var(--red);
}
/* Under the hole name (its own row on phones): who you're playing, where
   they are, and 👀 / 💬. */
.bbar {
  grid-column: 1;
  grid-row: 2;
  justify-self: start;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: min(100%, 460px);
  min-width: 0;
  padding: 3px;
  border-radius: 10px;
  border: 2.5px solid var(--ink);
  background: var(--opp-paper) var(--grain);
  color: var(--ink);
  box-shadow: var(--lift);
  font-size: 12.5px;
  font-weight: 600;
  pointer-events: auto;
}
#btInfo {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#btInfo b {
  font-weight: 800;
}
#btInfo em {
  font-style: normal;
  font-family: var(--display);
  font-size: 11px;
  padding: 0 4px;
  border-radius: 5px;
  background: var(--ink);
  color: var(--tee);
}
.bb-btn {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 2px solid var(--ink);
  background: var(--paper);
  font-size: 15px;
  line-height: 1;
}
.bb-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.bb-emos {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  display: flex;
  gap: 6px;
  padding: 5px;
  border-radius: 12px;
  border: 2.5px solid var(--ink);
  background: var(--paper) var(--grain);
  box-shadow: var(--lift);
  animation: rise 0.25s both;
}
.bb-emos button {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 22px;
  background: var(--paper-2);
  border: 2px solid var(--ink-3);
}
.bb-emos button:active {
  transform: scale(0.9);
}
.ghost-tag.opp {
  background: var(--opp-paper);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ghost-tag.opp.emo {
  font-size: 15px;
  animation: bump 0.45s cubic-bezier(0.3, 1.8, 0.5, 1);
}
/* Spectating: a ticket at the bottom says whose ball you're watching. */
.watch-bar {
  position: absolute;
  left: 50%;
  bottom: calc(22px + var(--safe-b));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100% - 32px);
  padding: 6px 6px 6px 14px;
  border-radius: 14px;
  border: 2.5px solid var(--ink);
  background: var(--opp-paper) var(--grain);
  color: var(--ink);
  box-shadow: var(--lift);
  font-weight: 800;
  font-size: 14px;
  pointer-events: auto;
  animation: rise 0.3s both;
}
#wbText {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#wbBack {
  flex: none;
  padding: 8px 12px;
  border-radius: 10px;
  border: 2px solid var(--ink);
  background: var(--tee);
  font-family: var(--display);
  font-size: 13px;
  box-shadow: 0 3px 0 var(--ink);
}
body[data-mode="spectate"] #hud .hud-c,
body[data-mode="spectate"] #hud .hud-r {
  opacity: 0.35;
}
/* The lobby. */
.panel.battlep h3 {
  background: var(--opp-paper);
}
.bt-body {
  display: grid;
  gap: 10px;
}
.bt-lede {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  color: var(--ink);
}
.bt-fine {
  margin: 0;
  text-align: center;
  font-size: 12px;
  color: var(--ink-2);
}
.bt-worlds {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.bt-worlds button {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 6px 2px 5px;
  border-radius: 10px;
  border: 2px solid var(--ink);
  color: #fff;
  font-weight: 800;
  font-size: 11px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  opacity: 0.72;
}
.bt-worlds button:first-child {
  color: var(--ink);
  text-shadow: none;
}
.bt-worlds button.on {
  opacity: 1;
  outline: 3px solid var(--ink);
  outline-offset: 1px;
  box-shadow: 0 3px 0 var(--ink);
}
.bt-worlds i {
  font-style: normal;
  font-size: 20px;
}
.bt-course {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 2.5px solid var(--ink);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
.bt-course i {
  font-style: normal;
  font-size: 28px;
}
.bt-course b {
  display: block;
  font-family: var(--display);
  font-weight: 400;
  font-size: 18px;
}
.bt-course small {
  font-weight: 700;
  font-size: 12px;
}
.bt-vs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.bt-vs > div {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 0;
  padding: 8px 6px;
  border-radius: 12px;
  border: 2.5px solid var(--ink);
  background: var(--paper-2);
  text-align: center;
}
.bt-vs .them {
  background: var(--opp-paper);
}
.bt-vs .them.wait {
  border-style: dashed;
}
.bt-vs small {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.bt-vs b {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
  font-size: 15px;
}
.bt-vs em {
  font-style: normal;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-2);
}
.bt-vs > i {
  font-style: normal;
  font-family: var(--display);
  font-size: 18px;
  color: var(--stamp);
}
.bt-code {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 8px;
  border-radius: 12px;
  border: 2.5px dashed var(--ink);
  text-align: center;
}
.bt-code small {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.bt-code b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 30px;
  letter-spacing: 0.14em;
  user-select: text;
  -webkit-user-select: text;
}
.bt-code span {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}
/* Results: both cards side by side, then what's next. */
.rbattle {
  display: grid;
  gap: 4px;
  margin: 0 0 12px;
  padding: 8px 10px 10px;
  border-radius: 10px;
  border: 2px solid var(--opp);
  background: var(--opp-paper);
}
.bt-head {
  font-weight: 800;
  font-size: 15px;
  text-align: center;
  margin-bottom: 2px;
}
.bt-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(5, 1fr) minmax(34px, auto);
  align-items: center;
  gap: 2px;
  font-size: 13px;
  font-weight: 700;
}
.bt-row > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bt-row .c {
  text-align: center;
}
.bt-row b {
  text-align: right;
  font-family: var(--display);
  font-weight: 400;
}
.bt-acts {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 8px;
  margin-top: 6px;
}
.bt-acts:empty {
  display: none;
}
.bt-acts button.ghost {
  min-height: 44px;
  font-size: 13.5px;
  padding: 8px 6px;
}
.bt-acts button.hot {
  background: var(--tee);
  animation: bt-wiggle 0.5s ease-in-out 3;
}
@keyframes bt-wiggle {
  25% {
    transform: rotate(-2deg);
  }
  75% {
    transform: rotate(2deg);
  }
}
#btnBattle .dot {
  background: var(--green);
}
@media (max-width: 560px) {
  #hud {
    grid-template-areas: "l r" "c c" "b b";
  }
  .bbar {
    grid-area: b;
    justify-self: center;
    max-width: 100%;
  }
  body.in-battle .mini {
    top: calc(166px + var(--safe-t));
  }
}

/* ── The journey: come-back gift, season punch card, world passport ───── */
.rival.gift {
  border-color: var(--stamp);
  background: #ffe9e4;
  animation: gift-wob 2.6s ease-in-out infinite;
}
@keyframes gift-wob {
  0%,
  86%,
  100% {
    transform: rotate(0);
  }
  90% {
    transform: rotate(-1.2deg);
  }
  95% {
    transform: rotate(1.2deg);
  }
}
.journey-note {
  border-color: #d8562a;
  background: #fff0dc;
}
/* On the results ticket it lists what today earned, a line each. */
.res-box .journey-note {
  margin: -2px 0 12px;
  text-align: left;
  position: relative;
  padding-right: 26px;
}
.res-box .journey-note span {
  display: block;
  font-weight: 600;
  line-height: 1.4;
}
.res-box .journey-note span + span {
  margin-top: 3px;
  padding-top: 3px;
  border-top: 1.5px dashed var(--ink-4);
}
.res-box .journey-note > i {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
}
.panel.journeyp {
  width: min(440px, 100%);
}
.jy-body {
  display: grid;
  gap: 9px;
}
.jy-gift {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 2px dashed var(--ink-3);
  background: var(--paper-2);
}
.jy-gift.on {
  border: 2.5px solid var(--stamp);
  background: #ffe9e4;
}
.jy-gift > i {
  font-style: normal;
  font-size: 30px;
  line-height: 1;
}
.jy-gift b {
  display: block;
  font-family: var(--display);
  font-weight: 400;
  font-size: 14px;
}
.jy-gift small {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.jy-wk,
.jy-card {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  justify-items: center;
}
.jy-wk b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 10px;
  color: var(--ink-2);
}
/* Each day is a spot on the card: a number until it's punched clean through. */
.jy-card i {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px dashed var(--ink-3);
  font-style: normal;
  font-family: var(--display);
  font-size: 12px;
  color: var(--ink-2);
}
.jy-card i.blank {
  border: 0;
}
.jy-card i.punched {
  border: 2.5px solid var(--ink);
  background: radial-gradient(circle at 50% 50%, #2a2052 0 58%, #d8562a 60% 100%);
  color: transparent;
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.35);
}
.jy-card i.missed {
  opacity: 0.45;
  text-decoration: line-through;
}
.jy-card i.today {
  border: 2.5px solid var(--stamp);
  color: var(--ink);
  background: var(--tee);
  animation: jy-pulse 1.4s ease-in-out infinite;
}
.jy-card i.finale:not(.punched) {
  font-size: 17px;
  border-style: solid;
  border-color: #ff8a2a;
}
@keyframes jy-pulse {
  50% {
    transform: scale(1.12);
  }
}
.jy-rws {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}
.jy-rw {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 1px;
  padding: 7px 4px 6px;
  border-radius: 10px;
  border: 2px solid var(--ink-3);
  background: var(--paper-2);
  text-align: center;
}
.jy-rw img {
  width: 40px;
  height: 40px;
  filter: grayscale(0.85) opacity(0.6);
}
.jy-rw b {
  position: absolute;
  top: -8px;
  left: -5px;
  min-width: 22px;
  padding: 1px 5px;
  border-radius: 6px;
  border: 2px solid var(--ink);
  background: var(--paper);
  font-family: var(--display);
  font-weight: 400;
  font-size: 11px;
  transform: rotate(-5deg);
}
.jy-rw span {
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
}
.jy-rw em {
  font-style: normal;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.jy-rw.got {
  border: 2px solid var(--ink);
  background: #d9f6e4;
}
.jy-rw.got img {
  filter: none;
}
.jy-rw.got em {
  color: var(--green);
  font-weight: 800;
}
.jy-pass {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
/* A passport stamp: a faint outline until its world is played, then inked. */
.jy-st {
  display: grid;
  justify-items: center;
  padding: 7px 2px 5px;
  border-radius: 12px;
  border: 2px dashed var(--ink-3);
  opacity: 0.55;
  text-align: center;
}
.jy-st i {
  font-style: normal;
  font-size: 22px;
  line-height: 1.15;
  filter: grayscale(1);
}
.jy-st b {
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.1;
}
.jy-st em {
  font-style: normal;
  font-family: var(--display);
  font-size: 9.5px;
  color: var(--ink-2);
}
.jy-st.on {
  opacity: 1;
  border: 2.5px double var(--ink);
  background: color-mix(in srgb, var(--st) 42%, var(--paper));
  transform: rotate(-2deg);
}
.jy-st.on:nth-child(even) {
  transform: rotate(2.5deg);
}
.jy-st.on i {
  filter: none;
}
@media (max-width: 400px) {
  .jy-card i {
    width: 30px;
    height: 30px;
  }
  .jy-rws {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── The reminder ask on the results ticket ───────────────────────────── */
.rnudge {
  margin: -2px 0 12px;
  padding: 9px 10px 8px;
  border-radius: 12px;
  border: 2.5px solid var(--ink);
  background: #fff8bf var(--grain);
  box-shadow: 0 3px 0 var(--ink);
  animation: rise 0.4s 0.15s both;
}
.rn-t {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.35;
}
.rnudge .tm-remind {
  margin-top: 7px;
}
.rn-b {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
}
.res-box .rn-b .link.small {
  margin: 7px 0 0;
}
.panel.a2hsp {
  width: min(400px, 100%);
}
.ah-steps {
  margin: 0;
  padding: 0 0 0 4px;
  list-style: none;
  counter-reset: ah;
  display: grid;
  gap: 8px;
}
.ah-steps li {
  counter-increment: ah;
  position: relative;
  padding: 8px 10px 8px 44px;
  border-radius: 10px;
  border: 2px solid var(--ink);
  background: var(--paper-2);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
}
.ah-steps li::before {
  content: counter(ah);
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--tee);
  font-family: var(--display);
  font-size: 12px;
}
.ah-steps span {
  color: var(--ink-2);
  font-weight: 500;
}
.ghost-a {
  display: block;
  padding: 9px 10px;
  border-radius: 10px;
  border: 2px dashed var(--ink-3);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

/* ── How was today's course? ──────────────────────────────────────────── */
.rrate {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin: 12px 0 2px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}
.rrate button[data-r] {
  width: 42px;
  height: 38px;
  border-radius: 10px;
  border: 2px solid var(--ink);
  background: var(--paper);
  box-shadow: 0 3px 0 var(--ink);
  font-size: 20px;
  line-height: 1;
}
.rrate button[data-r]:active {
  transform: translateY(3px);
  box-shadow: none;
}
.res-box .rrate .link.small {
  margin: 0;
}

/* ── Challenge a friend: pick the round or a hole, send the link ─────── */
button.ghost.chal-btn {
  background: #ffe1ea var(--grain);
}
.panel.chalp {
  width: min(420px, 100%);
}
.ch-pick {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.ch-pick:empty {
  display: none;
}
.ch-pick button {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 8px;
  padding: 7px 9px;
  border-radius: 11px;
  border: 2px solid var(--ink-3);
  background: var(--paper-2);
  color: var(--ink);
  text-align: left;
}
.ch-pick button:first-child {
  grid-column: 1 / -1;
}
.ch-pick button i {
  grid-row: span 2;
  font-style: normal;
  font-size: 22px;
}
.ch-pick button b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 12.5px;
}
.ch-pick button small {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ch-pick button.on {
  border: 2.5px solid var(--ink);
  background: var(--tee);
  box-shadow: 0 3px 0 var(--ink);
}
.ch-text {
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 2px dashed var(--ink-3);
  background: var(--paper-2);
  font: 600 12px/1.4 var(--font);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 96px;
  overflow: auto;
  user-select: text;
  -webkit-user-select: text;
}
.panel.chalp .link {
  justify-self: center;
}

/* ── The mulligan: a ticket stub by your thumb, only while you can use it ── */
.mull-btn {
  position: absolute;
  left: calc(12px + env(safe-area-inset-left, 0px));
  bottom: calc(24px + var(--safe-b));
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 12px 6px;
  border-radius: 12px;
  border: 2.5px solid var(--ink);
  background: var(--paper) var(--grain);
  color: var(--ink);
  box-shadow: var(--lift);
  font-family: var(--display);
  font-size: 13px;
  line-height: 1.1;
  transform: rotate(-2deg);
  animation: rise 0.4s both;
}
.mull-btn small {
  font-family: var(--font);
  font-weight: 700;
  font-size: 10px;
  color: var(--ink-2);
}
.mull-btn:active {
  transform: translateY(4px) rotate(-2deg);
  box-shadow: none;
}
body:not([data-mode="aim"]) .mull-btn {
  display: none;
}
.hc .hm {
  position: absolute;
  top: 24px;
  left: 3px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-2);
}

/* ── The daily foursome ───────────────────────────────────────────────── */
.tally .tf {
  padding: 5px 12px 7px;
  border-top: 2px dashed var(--ink-4);
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
}
.tally .tf b {
  font-family: var(--display);
  font-weight: 400;
}
.rfour {
  margin: -2px 0 12px;
  padding: 8px 10px 7px;
  border-radius: 10px;
  border: 2px solid var(--ink);
  background: #eafbe7;
  font-size: 13.5px;
  animation: rise 0.4s both;
}
.rf-h {
  margin-bottom: 5px;
  font-weight: 700;
  text-align: center;
}
.rf-r {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: baseline;
  gap: 6px;
  padding: 2px 4px;
  border-radius: 6px;
  font-weight: 600;
}
.rf-r i {
  font-style: normal;
  font-family: var(--display);
  font-size: 11.5px;
  color: var(--ink-2);
}
.rf-r span {
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rf-r b {
  font-family: var(--display);
  font-weight: 400;
}
.rf-r b.under {
  color: var(--green);
}
.rf-r b.over {
  color: var(--red);
}
.rf-r.me {
  background: var(--tee);
  font-weight: 800;
}
.rfour small {
  display: block;
  margin-top: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
  text-align: center;
}

/* ── First load: a practice green on the veil, and a still behind the title ── */
.ld-putt {
  display: none;
  width: min(280px, 78vw);
  height: auto;
  aspect-ratio: 280 / 190;
  margin-top: 4px;
  touch-action: none;
  cursor: grab;
  pointer-events: auto;
  animation: rise 0.5s both;
}
.ld-putt.on {
  display: block;
}
#loading.done .ld-putt {
  pointer-events: none;
}
.ld-tip {
  display: none;
  font-family: var(--font);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0;
  opacity: 0.75;
}
.ld-tip.on {
  display: block;
}
/* With the green up, the bouncing ball makes way for it. */
#loading:has(.ld-putt.on) .spin {
  display: none;
}
#gl {
  transition: opacity 0.7s;
}
body.poster #gl {
  opacity: 0;
}
/* The shot of the day on the title: a little film ticket. */
.shot-note {
  border-color: var(--ink);
  background: #1c1640;
  color: var(--paper);
}
.shot-note i {
  color: var(--tee);
}
body.poster::before {
  content: "";
  position: fixed;
  inset: 0;
  background: #16113a var(--poster) center / cover no-repeat;
}

/* ── The gallery: players' holes ──────────────────────────────────────── */
.panel.galp {
  width: min(440px, 100%);
}
.gl-body {
  display: grid;
  gap: 8px;
}
.gl-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 12px;
  border: 2px solid var(--ink);
  background: var(--paper-2);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 3px 0 var(--ink);
}
.gl-row:active {
  transform: translateY(3px);
  box-shadow: none;
}
.gl-row > i {
  font-style: normal;
  font-size: 24px;
}
.gl-row b {
  display: block;
  font-family: var(--display);
  font-weight: 400;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gl-row small {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}
.gl-row em {
  font-style: normal;
  font-family: var(--display);
  font-size: 15px;
}
.gl-row.feat {
  background: var(--tee) var(--grain);
  border-width: 2.5px;
}
.rgal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: -2px 0 12px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 2px solid var(--ink);
  background: #fff1c2;
  font-size: 13.5px;
  font-weight: 700;
}
.res-box .rgal .link.small {
  margin: 0;
}

/* ── The Monthly Major ────────────────────────────────────────────────── */
.major-note {
  border-color: var(--ink);
  background: #0f6b3a;
  color: #fff4dc;
}
.major-note b {
  color: var(--tee);
}
.panel.majorp {
  width: min(430px, 100%);
}
.mj-you {
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 2px solid var(--ink);
  background: #d9f6e4;
  font-size: 13.5px;
  font-weight: 700;
  text-align: center;
}
.mj-you b {
  font-family: var(--display);
  font-weight: 400;
}
/* A nine-hole card: the tally between holes sits tighter. */
.tally .tr:has(.tc:nth-child(9)) .mk {
  --mk: 26px;
  font-size: 15px;
}
.tally .tr:has(.tc:nth-child(9)) .tc small:last-child {
  display: none;
}

/* ── Modifier days and the Encore's finale extras ─────────────────────── */
.stat.wind b {
  display: grid;
  place-items: center;
}
.stat.wind i {
  display: inline-block;
  font-style: normal;
  font-family: var(--font);
  font-weight: 800;
  line-height: 1;
  transition: transform 0.12s linear;
}
.rival.mod {
  border-color: var(--ink);
  background: #e9e4ff;
}
.card .goal.combo {
  border-color: var(--blue);
  background: #dff1ff;
}
.card .goal.mod {
  border-color: var(--ink);
  background: #e9e4ff;
}

/* ── On a game portal (tools/gen-portal.mjs): no ways out of the frame ── */
body.portal .title-about,
body.portal a.link,
body.portal .ghost-a,
body.portal #btnChal,
body.portal #btnCard,
body.portal #btnBattle,
body.portal #rNudge,
body.portal #rRemind,
body.portal #rRemindHint,
body.portal #tRemind,
body.portal #mRemind,
body.portal #bdLink,
body.portal #lbInvite {
  display: none !important;
}
