/* Speech balloons, election night, and the notice when the service is missing. Same paint as the HUD. */
/* --- a line of speech over a bear's head: a comic balloon, inked by hand -------------------------------- */
.bubbles { position: fixed; left: 0; top: 0; z-index: 11; pointer-events: none; font-family: var(--body); }
.bubbles[hidden] { display: none; }
.bubble {
  position: absolute; left: 0; top: 0;
  box-sizing: border-box; width: max-content; max-width: min(300px, 72vw);
  padding: 8px 14px 9px;
  background: var(--white); color: var(--brown-deep);
  border: 3px solid var(--brown-deep);
  /* (no two corners the same: it was drawn, not stamped) */
  border-radius: 20px 24px 18px 26px / 22px 18px 24px 20px;
  box-shadow: 3px 4px 0 var(--ink);
  font-size: 14.5px; font-weight: 700; line-height: 1.3;
  transition: opacity 0.3s ease;
  will-change: transform;
}
.bubble p { margin: 0; overflow-wrap: anywhere; }
.bubble b { color: var(--red); font-weight: 900; text-transform: uppercase; font-size: 0.8em; letter-spacing: 0.06em; margin-right: 6px; }
.bubble i { font-style: normal; color: transparent; }
/* the tail: a square on its corner, half hidden under the balloon */
.bubble u {
  position: absolute; left: var(--tail, 50%); bottom: -10px;
  width: 13px; height: 13px; margin-left: -9px;
  background: var(--white);
  border: 3px solid var(--brown-deep); border-top: 0; border-left: 0;
  transform: rotate(45deg) skew(8deg, 8deg);
}
.bubble.loose u { display: none; }
.bubble.out, .bubble.off { opacity: 0; }
@media (max-height: 430px), (max-width: 520px) {
  .bubble { font-size: 13.5px; max-width: min(250px, 72vw); padding: 6px 11px 7px; }
}
@media (prefers-reduced-motion: reduce) {
  .bubble { transition: none; }
}

/* --- election night: the cold open -------------------------------------------------------- */
/* the HUD steps out for it, and comes back as the morning comes up */
body.intro-on #hud, body.intro-on .bubbles { opacity: 0; }
/* and for the showcase tour (player/tour.js, the switch tour): no words on the screen while it plays */
body.tour-on #hud, body.tour-on .bubbles { opacity: 0; pointer-events: none; }
.intro { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 40; font-family: var(--body); color: var(--white); touch-action: none; cursor: default; }
.intro.lifting { pointer-events: none; }
.intro-black { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: #0b0705; opacity: 0; transition: opacity 0.55s ease; }
.intro-black.on { opacity: 1; }
.intro.lifting .intro-black { transition-duration: 1.4s; }
/* a card on black: the two that are only words, lettered like the sign over the shop */
.intro-title {
  position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%) rotate(-2deg);
  padding: 0 calc(20px + var(--safe-r)) 0 calc(20px + var(--safe-l));
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0 0.3em;
  --sign: clamp(44px, 9.5vw, 96px); line-height: 0;
  opacity: 0; transition: opacity 0.5s ease;
}
/* a caption: one sentence on a painted board across the lower third, tile along its top */
.intro-cap {
  position: absolute; left: 50%; bottom: 7%; transform: translateX(-50%) rotate(-0.5deg);
  width: min(880px, calc(100% - 28px - var(--safe-l) - var(--safe-r))); box-sizing: border-box;
  padding: 22px 26px 16px;
  color: var(--brown-deep); text-shadow: none;
  background: var(--paper);
  background-image: linear-gradient(170deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0) 36%), repeating-linear-gradient(0deg, rgba(36, 21, 12, 0) 0 26px, rgba(36, 21, 12, 0.06) 26px 27px);
  border: 4px solid var(--brown-deep); border-radius: 5px;
  box-shadow: 0 7px 0 var(--brown-deep), 0 11px 0 rgba(0, 0, 0, 0.4);
  text-align: center; opacity: 0; transition: opacity 0.5s ease;
}
.intro-cap::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 12px;
  background: var(--tile) 0 0 / 36px 36px repeat-x; border-bottom: 3px solid var(--brown-deep);
}
.intro-cap p { margin: 0 auto; max-width: 28em; font-size: clamp(17px, 2.9vw, 30px); font-weight: 900; line-height: 1.25; letter-spacing: 0.005em; }
.intro-who { display: none; }
/* the news: the island's own broadcast. Who is speaking on a red tab, the way a lower third names them. */
.intro-cap.news { text-align: left; background-color: #14324a; color: var(--white); background-image: linear-gradient(170deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 40%); }
.intro-cap.news::before { background: var(--red); background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0) 0 22px, rgba(255, 255, 255, 0.55) 22px 26px); }
.intro-cap.news p { margin: 0; max-width: none; }
.intro-cap.news .intro-who {
  display: block; position: absolute; left: 18px; bottom: calc(100% - 2px);
  background: var(--red); color: var(--white); padding: 5px 16px 4px;
  border: 4px solid var(--brown-deep); border-bottom: 0; border-radius: 6px 6px 0 0;
  font-size: clamp(12px, 1.6vw, 16px); font-weight: 900; letter-spacing: 0.14em;
}
.intro-title.on, .intro-cap.on { opacity: 1; }
.intro-skip {
  position: absolute; right: calc(14px + var(--safe-r)); bottom: calc(10px + var(--safe-b));
  font-size: 11px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 5px 14px 6px; opacity: 0; transition: opacity 0.4s ease;
}
.intro-skip.on { opacity: 0.92; }
@media (max-height: 430px) {
  /* a phone on its side has no lower third to spare: the board sits on the bottom edge */
  .intro-cap { bottom: calc(4px + var(--safe-b)); padding: 16px 18px 9px; }
  .intro-cap::before { height: 8px; background-size: 24px 24px; }
  .intro-cap p { font-size: 17px; }
  .intro-skip { bottom: auto; top: calc(8px + var(--safe-t)); }
  .intro-title { --sign: clamp(40px, 9vw, 70px); }
}
@media (prefers-reduced-motion: reduce) {
  .intro-black, .intro-title, .intro-cap, .intro.lifting .intro-black { transition-duration: 0.01s; }
}

/* --- the notice when the service behind the page is missing or old (ui/trouble.js) --------------------
   The sign taped to a dead payphone: a painted OUT OF ORDER header on a sheet of paper, two strips of
   masking tape. It has to be read, so it is big, plain and on top of everything. */
.trouble {
  position: fixed;
  z-index: 90;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: 50%;
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 28px);
  display: flex;
  flex-direction: column;
  transform: translateX(-50%) rotate(-0.6deg);
  box-sizing: border-box;
  padding: 0 16px 12px;
  background: var(--paper) repeating-linear-gradient(0deg, transparent 0 23px, rgba(31, 154, 168, 0.16) 23px 24px);
  color: var(--brown-deep);
  border: 3px solid var(--brown-deep);
  box-shadow: 0 6px 0 rgba(20, 12, 6, 0.45);
  font: 15px/1.6 var(--body);
  -webkit-user-select: text;
  user-select: text;
  touch-action: auto;
}
.trouble[hidden] { display: none; }
.trouble-body { flex: 1 1 auto; min-height: 0; overflow: auto; }
/* two strips of masking tape */
.trouble::before, .trouble::after {
  content: '';
  position: absolute;
  z-index: 2;
  top: -9px;
  width: 74px;
  height: 20px;
  background: rgba(243, 228, 174, 0.94);
  border: 1px solid rgba(120, 96, 52, 0.5);
}
.trouble::before { left: 18px; transform: rotate(-4deg); }
.trouble::after { right: 18px; transform: rotate(3deg); }
.trouble-head {
  --sign: 34px;
  display: flex;
  justify-content: center;
  gap: 0 9px;
  flex-wrap: wrap;
  flex: none;
  margin: 0 -16px 10px;
  padding: 14px 10px 8px;
  line-height: 0;
  background: var(--red) repeating-linear-gradient(90deg, transparent 0 46px, rgba(138, 31, 26, 0.35) 46px 48px);
  border-bottom: 3px solid var(--brown-deep);
  box-shadow: inset 0 -4px 0 var(--red-deep);
}
.trouble-title { display: block; font: bold 18px/1.25 var(--body); color: var(--red-deep); margin-bottom: 6px; }
.trouble-what { margin: 0 0 8px; }
.trouble-fix p { margin: 6px 0 2px; }
.trouble-fix code {
  display: block;
  margin: 2px 0 4px;
  padding: 6px 8px;
  background: var(--brown-deep);
  color: #ffe9b0;
  font: bold 14px/1.3 var(--mono);
  overflow-wrap: anywhere;
}
.trouble-foot { flex: none; display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; padding-top: 10px; border-top: 2px dashed rgba(36, 21, 12, 0.4); }
.trouble-btn { min-width: 104px; min-height: 44px; }
@media (max-height: 460px) {
  .trouble-head { --sign: 24px; padding: 10px 10px 5px; margin-bottom: 6px; }
  .trouble { font-size: 13.5px; line-height: 1.45; }
}
