/* The town's part of the screen: the minimap and the wallet, the line that says what to do now,
   a text arriving, the banners, and the realtor's sign at the corner lot. Same paint as the HUD. */

/* --- top left: the map on a round painted sign, a sand dollar beside it, and under them what to do now --- */
.hud-corner {
  left: calc(16px + var(--safe-l));
  top: calc(14px + var(--safe-t));
  --map: 140px;
}
.hud-top { display: flex; align-items: flex-start; gap: 16px; }
/* the sign: the map is its face; round it runs a white line, a red rim, and four bolts */
.hud-map {
  position: relative;
  width: var(--map); height: var(--map); flex: none;
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--white), 0 0 0 9px var(--red), 0 0 0 12px var(--brown-deep), 0 6px 0 12px var(--ink);
}
.hud-map canvas { display: block; width: 100%; height: 100%; border-radius: 50%; }
/* chipped paint on the rim, and the bolts that hold the sign up */
.hud-map::before {
  content: ""; position: absolute; left: -9px; top: -9px; right: -9px; bottom: -9px; border-radius: 50%; pointer-events: none;
  background:
    radial-gradient(circle at 50% 3px, #e9e2d2 0 2.4px, var(--brown-deep) 2.6px 3.6px, transparent 4px),
    radial-gradient(circle at 50% calc(100% - 3px), #e9e2d2 0 2.4px, var(--brown-deep) 2.6px 3.6px, transparent 4px),
    radial-gradient(circle at 3px 50%, #e9e2d2 0 2.4px, var(--brown-deep) 2.6px 3.6px, transparent 4px),
    radial-gradient(circle at calc(100% - 3px) 50%, #e9e2d2 0 2.4px, var(--brown-deep) 2.6px 3.6px, transparent 4px),
    radial-gradient(ellipse 7px 4px at 18% 12%, var(--wood) 98%, transparent),
    radial-gradient(ellipse 5px 3px at 84% 80%, var(--wood) 98%, transparent),
    radial-gradient(ellipse 4px 6px at 8% 66%, var(--wood) 98%, transparent);
  -webkit-mask-image: radial-gradient(circle, transparent calc(50% - 10px), #000 calc(50% - 9px));
  mask-image: radial-gradient(circle, transparent calc(50% - 10px), #000 calc(50% - 9px));
}
/* a streak of sun-fade across the glass */
.hud-map::after {
  content: ""; position: absolute; left: 0; top: 0; right: 0; bottom: 0; border-radius: 50%; pointer-events: none;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 36%);
}
.hud-side { display: flex; flex-direction: column; gap: 7px; padding-top: 0; }
/* the treasury: a sand dollar, and how many of them */
.hud-wallet {
  display: flex; align-items: center; gap: 8px;
  --sign: 34px; line-height: 0;
}
.hud-wallet[hidden] { display: none; }
.hud-wallet .coin {
  flex: none; width: 46px; height: 46px;
  background: var(--sand-dollar) center / contain no-repeat;
  filter: drop-shadow(0 4px 0 var(--ink));
}
.hud-wallet.paid .coin { animation: coin-flip 0.7s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes coin-flip {
  0% { transform: scale(1) rotate(0deg); }
  35% { transform: scale(1.35) rotate(-22deg); }
  70% { transform: scale(0.94) rotate(8deg); }
  100% { transform: none; }
}
.hud-wallet b { font-weight: 900; }
.hud-wallet i {
  --sign: 22px; font-style: normal; opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease; transform: translateY(6px) rotate(-6deg);
}
.hud-wallet i.show { opacity: 1; transform: rotate(-6deg); }
.hud-wallet-note {
  align-self: flex-start;
  font-size: 11.5px; padding: 5px 14px 6px; max-width: 190px; transform: rotate(-1.4deg);
  opacity: 0; transition: opacity 0.5s ease;
}
.hud-wallet-note.show { opacity: 1; }
/* what to do now: a strip of tape with the step written on it, and its clock when it has one */
.hud-now {
  margin-top: 16px; max-width: 300px; box-sizing: border-box;
  padding: 8px 18px 9px 16px;
  font-size: 13.5px; line-height: 1.25;
  transform: translateX(-10px) rotate(-0.8deg); opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.hud-now.show { opacity: 1; transform: rotate(-0.8deg); }
.now-timer { display: none; align-items: center; gap: 6px; margin-top: 6px; font-size: 10.5px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; }
.now-timer.show { display: flex; }
.now-timer b { color: var(--red-deep); font-weight: 900; margin-right: 2px; }
.now-bar {
  flex: 1; min-width: 70px; height: 12px; box-sizing: border-box; overflow: hidden;
  background: var(--white); border: 2px solid var(--brown-deep); border-radius: 3px;
}
.now-bar i { display: block; height: 100%; background: var(--green); background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0) 0 9px, rgba(255, 255, 255, 0.35) 9px 11px); transform-origin: left center; }
.now-timer.late .now-bar i { background-color: var(--red); }
.now-timer.late span:last-child { color: var(--red-deep); }

/* --- bottom left: the thing in the Mayor's paw ---------------------------------------------------------- */
.hud-hand {
  left: calc(12px + var(--safe-l));
  bottom: calc(12px + var(--safe-b));
  font-size: 12.5px; padding: 7px 18px 8px 14px; transform: rotate(1deg);
  opacity: 0; transition: opacity 0.18s ease;
}
.hud-hand.show { opacity: 1; }
body.touch-ui .hud-hand { display: none; }

/* --- a text has arrived: the strip of screen on the lid of the flip phone, in the phone's own dots --------- */
#hud .hud-text {
  -webkit-appearance: none; appearance: none;
  left: 50%; top: calc(12px + var(--safe-t)); transform: translate(-50%, -160%);
  width: max-content; max-width: calc(100vw - 24px); min-height: 48px; box-sizing: border-box;
  display: flex; align-items: flex-start; gap: 9px; text-align: left;
  padding: 7px 12px 5px 10px;
  color: #dfe9ff; text-shadow: none;
  background-color: #12287a;
  background-image: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0) 0 2px, rgba(0, 0, 20, 0.16) 2px 4px);
  border: 4px solid #1d2030; border-radius: 7px;
  box-shadow: 0 0 0 3px #d5dbe5, 0 0 0 6px var(--brown-deep), 0 6px 0 6px var(--ink);
  opacity: 0; pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.2, 1.3, 0.4, 1), opacity 0.2s ease;
}
#hud .hud-text.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
/* an envelope, blinking */
.hud-text-mail { flex: none; width: 18px; height: 14px; margin-top: 4px; image-rendering: pixelated; animation: text-blink 1s steps(2) infinite; }
@keyframes text-blink { 50% { opacity: 0.25; } }
.hud-text-words { display: flex; flex-direction: column; align-items: flex-start; gap: 0; min-width: 0; }
.hud-text .px { display: block; position: relative; line-height: 0; }
.hud-text .px svg { display: block; }
.hud-text .px:empty { display: none; }
.hud-text b { color: #ffd86a; }
.hud-text i { color: #9db4ff; }
/* how many texts are unread, on the phone in your pocket */
#hud .hud-phone.badge::after {
  content: attr(data-n);
  position: absolute; right: -10px; top: -11px;
  min-width: 20px; height: 20px; padding: 0 4px; box-sizing: border-box;
  border-radius: 10px; background: var(--red); color: var(--white);
  border: 2px solid var(--brown-deep); font: 900 11px/16px var(--body); text-align: center;
}

/* --- banners: painted signboards that slam in --------------------------------------------------------------- */
.banner {
  position: fixed; left: 0; right: 0; top: calc(13vh + var(--safe-t)); z-index: 40;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  pointer-events: none; font-family: var(--body); color: var(--white);
  padding: 0 12px;
}
/* the board: planks under the paint, a tile border top and bottom, a bolt in each corner */
.banner-card {
  position: relative;
  max-width: min(660px, 92vw); text-align: center;
  padding: 20px 34px 22px;
  background-color: var(--green);
  background-image:
    linear-gradient(165deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 40%),
    repeating-linear-gradient(0deg, rgba(36, 21, 12, 0) 0 26px, rgba(36, 21, 12, 0.16) 26px 28px);
  border: 4px solid var(--brown-deep);
  border-radius: 6px;
  box-shadow: inset 0 0 0 3px rgba(255, 250, 240, 0.4), 0 8px 0 var(--brown-deep), 0 12px 0 rgba(36, 21, 12, 0.35);
  transform: rotate(-2deg) scale(0.6); opacity: 0; visibility: hidden;
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s 0.35s;
}
.banner-card::before, .banner-card::after {
  content: ""; position: absolute; left: 7px; right: 7px; height: 12px;
  background: var(--tile) 0 0 / 36px 36px repeat-x;
  box-shadow: 0 0 0 2px var(--brown-deep);
}
.banner-card::before { top: 5px; background-position: 0 0; }
.banner-card::after { bottom: 5px; background-position: 6px -24px; }
.banner-card.show { opacity: 1; visibility: visible; transform: rotate(-2deg); transition: none; animation: banner-slam 0.5s cubic-bezier(0.2, 1.5, 0.4, 1); }
@keyframes banner-slam {
  0% { transform: rotate(-11deg) scale(3.4); opacity: 0; }
  46% { transform: rotate(-1deg) scale(0.92); opacity: 1; }
  62% { transform: rotate(-3.4deg) scale(1.03) translateY(3px); }
  80% { transform: rotate(-1.4deg) scale(0.99); }
  100% { transform: rotate(-2deg) scale(1); }
}
.banner-title { --sign: clamp(34px, 6.6vw, 62px); line-height: 0; text-shadow: none; display: flex; }
.banner-sub {
  display: table; margin: 6px auto 0; padding: 3px 14px 4px;
  font-size: clamp(12px, 2vw, 15px); font-weight: 700; color: var(--brown-deep); text-shadow: none;
  background: var(--tape); transform: rotate(1deg);
}
.banner-sub[hidden] { display: none; }
.banner-rewards { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 12px; min-height: 36px; }
.banner-rewards:empty { display: none; }
/* what it paid: price tags */
.banner .chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 13px 5px 11px;
  background: var(--white); color: var(--brown-deep);
  border: 3px solid var(--brown-deep); border-radius: 4px 14px 14px 4px; box-shadow: 0 3px 0 var(--brown-deep);
  font-size: clamp(14px, 2.4vw, 18px); font-weight: 900; font-variant-numeric: tabular-nums; text-shadow: none;
  opacity: 0; transform: translateY(10px) scale(0.7) rotate(-4deg);
  transition: opacity 0.15s ease, transform 0.24s cubic-bezier(0.2, 1.7, 0.4, 1);
}
.banner .chip.show { opacity: 1; transform: rotate(-1.5deg); }
.banner .chip:nth-child(even).show { transform: rotate(1.5deg); }
.banner .chip .coin { width: 24px; height: 24px; background: var(--sand-dollar) center / contain no-repeat; }
.banner .chip i { font-style: normal; font-size: 0.78em; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brown); }
.banner .chip.warm i { color: var(--red); font-size: 1em; }
.banner .chip.cool { background: #e3e6ee; }
.banner .chip.cool i { color: #55627a; font-size: 1em; }
.banner .chip.sand { background: #ffe9a8; }
/* BUMMER: a blue board that drops and hangs crooked */
.banner-card.bummer { background-color: #3f6fae; padding: 18px 28px 20px; transform: rotate(2.4deg) scale(0.6); }
.banner-card.bummer.show { transform: rotate(2.4deg); animation: banner-sag 0.6s ease-out; }
@keyframes banner-sag {
  0% { transform: rotate(0deg) translateY(-60px); opacity: 0; }
  50% { transform: rotate(5deg) translateY(6px); opacity: 1; }
  75% { transform: rotate(1.4deg) translateY(0); }
  100% { transform: rotate(2.4deg); }
}
.banner-card.bummer .banner-title { --sign: clamp(30px, 6vw, 54px); }
/* the corner lot: gold */
.banner-card.lot { background-color: #e09a24; }
/* BUSTED: red, stamped on */
.banner-card.busted { background-color: var(--red); transform: rotate(-4deg) scale(0.6); }
.banner-card.busted.show { transform: rotate(-4deg); animation: banner-slam 0.4s cubic-bezier(0.2, 1.5, 0.4, 1); }
/* BEAT L.A.: teal and gold, the island's own colors */
.banner-card.beat { background-color: var(--teal); }
/* a change of band: a painted streamer */
.banner-ribbon {
  padding: 8px 36px; font-size: clamp(13px, 2.6vw, 20px); font-weight: 900; letter-spacing: 0.08em;
  color: var(--white); background: var(--brown-deep); border-top: 3px solid var(--gold); border-bottom: 3px solid var(--gold);
  box-shadow: 0 4px 0 var(--ink); text-shadow: 0 2px 0 var(--ink);
  clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 50%, 100% 100%, 0 100%, 14px 50%);
  opacity: 0; transform: scaleX(0.2); visibility: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s 0.3s;
}
.banner-ribbon.show { opacity: 1; transform: none; visibility: visible; transition: opacity 0.2s ease, transform 0.35s cubic-bezier(0.2, 1.4, 0.4, 1); }
.banner-ribbon i { font-style: normal; font-weight: 700; text-transform: none; letter-spacing: 0; opacity: 0.85; }
/* the bands' own colors, pale to deep so they read without hue (the phone's map uses the same ramp) */
.banner-ribbon .band0 { color: #c9b8a6; }
.banner-ribbon .band1 { color: #f0d890; }
.banner-ribbon .band2 { color: #a8e08a; }
.banner-ribbon .band3 { color: #7ff0d0; }

/* --- the corner lot: the realtor's FOR SALE sign -------------------------------------------------------------- */
.lotboard {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 25;
  display: flex; align-items: center; justify-content: center;
  padding: calc(8px + var(--safe-t)) calc(10px + var(--safe-r)) calc(8px + var(--safe-b)) calc(10px + var(--safe-l));
  background: rgba(18, 10, 6, 0.45);
  font-family: var(--body); touch-action: manipulation;
}
.lotboard[hidden] { display: none; }
/* the sign: white board, red top, hung by two chains from an arm you cannot see */
.lot-card {
  position: relative;
  width: min(900px, 100%); max-height: 100%; display: flex; flex-direction: column;
  background: var(--white); color: var(--brown-deep);
  background-image: linear-gradient(170deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0) 30%), repeating-linear-gradient(0deg, rgba(36, 21, 12, 0) 0 30px, rgba(36, 21, 12, 0.05) 30px 31px);
  border: 4px solid var(--brown-deep); border-radius: 5px;
  box-shadow: inset 0 0 0 3px rgba(214, 52, 42, 0.5), 0 8px 0 var(--brown-deep), 0 12px 0 rgba(36, 21, 12, 0.35);
  overflow: hidden;
  transform: rotate(-0.4deg);
}
.lot-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 16px 8px; background: var(--red); color: var(--white);
  background-image: linear-gradient(165deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 45%);
  border-bottom: 4px solid var(--brown-deep);
}
.lot-title { display: flex; align-items: center; gap: 4px 14px; flex-wrap: wrap; min-width: 0; }
.lot-title b { --sign: 38px; line-height: 0; }
.lot-title .where { --sign: 22px; line-height: 0; }
.lot-title span.realty { display: block; flex-basis: 100%; font: italic 700 12.5px/1.2 Georgia, "Times New Roman", serif; letter-spacing: 0.04em; opacity: 0.96; }
.lot-wallet { display: flex; align-items: center; gap: 7px; --sign: 30px; line-height: 0; flex: none; }
.lot-wallet .coin { width: 36px; height: 36px; background: var(--sand-dollar) center / contain no-repeat; filter: drop-shadow(0 3px 0 rgba(36, 21, 12, 0.5)); }
.lot-options { display: flex; gap: 12px; padding: 14px 14px 10px; overflow-y: auto; }
/* each thing it could become: a rider hung under the sign */
.lot-option {
  -webkit-appearance: none; appearance: none;
  position: relative;
  flex: 1 1 0; min-width: 0; text-align: left; font: inherit; color: inherit; cursor: pointer;
  padding: 16px 12px 10px; border-radius: 4px; border: 3px solid var(--brown-deep); background: var(--paper);
  box-shadow: 0 4px 0 var(--brown-deep);
  display: flex; flex-direction: column; gap: 4px;
}
/* a band of its own paint across the top, with two holes for the hooks */
.lot-option::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 9px;
  background: var(--teal);
  background-image: radial-gradient(circle at 18px 4.5px, var(--brown-deep) 0 2.4px, transparent 3px), radial-gradient(circle at calc(100% - 18px) 4.5px, var(--brown-deep) 0 2.4px, transparent 3px);
  border-bottom: 2px solid var(--brown-deep);
}
.lot-option[data-option="ramp"]::before { background-color: var(--pink); }
.lot-option[data-option="garden"]::before { background-color: var(--green); }
.lot-option.on { background: var(--white); border-color: var(--green-deep); box-shadow: 0 0 0 4px var(--green), 0 4px 0 4px var(--brown-deep); transform: translateY(-2px) rotate(-0.6deg); }
.lot-option.dear:not(.on) { opacity: 0.8; }
.lot-option.current { border-style: dashed; }
.lot-name { --sign: 25px; line-height: 0; justify-content: flex-start; }
.lot-what { font-size: 12.5px; font-weight: 700; color: var(--brown); }
.lot-price { display: flex; align-items: center; gap: 6px; font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; margin: 2px 0; }
.lot-price .coin { width: 24px; height: 24px; background: var(--sand-dollar) center / contain no-repeat; }
.lot-price s { font-size: 14px; font-weight: 700; opacity: 0.6; }
.lot-price.here { font-size: 13px; color: var(--green); text-transform: uppercase; letter-spacing: 0.06em; }
.lot-option.dear .lot-price b { color: var(--red-deep); }
.lot-effect { font-size: 11px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; color: var(--green); }
.lot-fans, .lot-critics { font-size: 12.5px; font-weight: 700; line-height: 1.3; }
.lot-fans i { font-style: normal; color: var(--red); }
.lot-critics i { font-style: normal; color: #55627a; }
.lot-foot { display: flex; align-items: center; gap: 12px; padding: 2px 14px 14px; }
.lot-msg { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 700; color: var(--red-deep); text-align: right; }
.lot-foot button { padding: 0 18px; min-height: 46px; font-size: 13px; }
.lot-build { background-color: var(--green); color: var(--white); text-shadow: 0 2px 0 var(--green-deep); font-size: 14px; }
.lot-build.no { background-color: #a89a86; text-shadow: none; }
/* the second press: it is asking, so it looks like a question and not like the button it was */
.lot-build.sure { background-color: var(--gold); color: var(--brown-deep); text-shadow: none; animation: sure-nudge 0.5s ease 2; }
@keyframes sure-nudge { 50% { transform: rotate(-1.6deg) scale(1.04); } }
.lot-foot button:focus-visible, .lot-option:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* while the board is up, or the lot is going up, the game's own controls step back */
body.boarding .touch, body.cine .touch, body.boarding .hud-prompt, body.cine .hud-prompt, body.cine .hud-hint, body.cine .hud-hand, body.cine .hud-now, body.cine .hud-time { display: none; }

@media (max-height: 430px) {
  .lot-head { padding: 4px 14px; }
  .lot-title b { --sign: 28px; }
  .lot-title .where { --sign: 17px; }
  .lot-title span.realty { display: none; }
  .lot-options { padding: 9px 9px 7px; gap: 9px; }
  .lot-option { padding: 13px 10px 6px; gap: 2px; }
  .lot-name { --sign: 20px; }
  .lot-what, .lot-fans, .lot-critics { font-size: 11.5px; }
  .lot-price { font-size: 18px; margin: 0; }
  .lot-foot { padding: 0 9px 9px; }
  .lot-foot button { min-height: 44px; }
  .banner { top: calc(6vh + var(--safe-t)); gap: 8px; }
  .banner-card { padding: 16px 26px 18px; max-width: min(580px, 70vw); }
  .banner-title { --sign: clamp(30px, 6.4vw, 50px); }
  .banner-rewards { margin-top: 8px; }
  .hud-corner { --map: 92px; top: calc(12px + var(--safe-t)); left: calc(14px + var(--safe-l)); }
  .hud-map { box-shadow: 0 0 0 2px var(--white), 0 0 0 7px var(--red), 0 0 0 9px var(--brown-deep), 0 5px 0 9px var(--ink); }
  .hud-wallet { --sign: 28px; }
  .hud-wallet .coin { width: 38px; height: 38px; }
  .hud-now { max-width: 250px; font-size: 12px; padding: 6px 15px 7px 13px; margin-top: 12px; }
}
/* Upright on a phone there is one column to share with the clock and its buttons: the wallet
   drops to the foot of the minimap, the buttons that jump the time of day go, and a text
   arrives under the line instead of over it. */
@media (max-width: 520px) {
  .hud-corner { --map: 100px; }
  .hud-side { height: var(--map); padding: 0; }
  .hud-wallet { margin-top: auto; --sign: 30px; position: relative; }
  .hud-wallet .coin { width: 40px; height: 40px; }
  /* no room beside the number: what was just paid floats up from the coin */
  .hud-wallet i { position: absolute; left: 48px; bottom: 86%; white-space: nowrap; }
  .hud-wallet-note { position: absolute; left: 0; top: calc(var(--map) + 16px); max-width: none; white-space: nowrap; }
  .hud-now { max-width: 300px; font-size: 12.5px; margin-top: 46px; }
  .hud-times { display: none; }
  #hud .hud-text { top: calc(236px + var(--safe-t)); max-width: 88vw; }
  /* the three riders hang one above the other */
  .lot-options { flex-direction: column; }
  .lot-option { flex: none; }
  .lot-foot { flex-wrap: wrap; }
  .lot-msg { order: -1; flex-basis: 100%; text-align: left; }
  .lot-build { flex: 1; }
  .lot-title b { --sign: 30px; }
  .lot-title .where { display: none; }
}
/* reduced motion: the same words, and nothing flies */
@media (prefers-reduced-motion: reduce) {
  .hud-now, #hud .hud-text, .hud-wallet i { transition: none; }
  .banner-card.show, .banner-card.bummer.show, .banner-card.busted.show, .hud-wallet.paid .coin, .lot-build.sure, .hud-text-mail, #hud .hud-tools .hud-phone.ring { animation: none; }
  .banner .chip, .banner-ribbon, .banner-ribbon.show { transition: opacity 0.2s ease; }
}
