/* VanillaCity, the browser game: the town is one canvas; everything else sits on top of it.
   Cream panels, TeamVanilla green, pill buttons. Phones get bottom sheets; wider screens, cards. */

:root {
  --green: #1ed67c;
  --green-deep: #17b566;
  --green-dark: #0f6e3e;
  --ink: #16151c;
  --ink-soft: #3a3942;
  --muted: #6d6a62;
  --paper: #fbf6ea;
  --panel: #fffdf8;
  --line: #e6dcc6;
  --peach: #f4a582;
  --brick: #a8442f;
  --gold: #e3b341;
  --shadow: 0 10px 30px rgba(22, 21, 28, .22), 0 2px 6px rgba(22, 21, 28, .14);
  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #cfe8f6;
  color: var(--ink);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
body { touch-action: manipulation; }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--green-dark); }

#world {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  image-rendering: pixelated;
  cursor: pointer;
}

/* ---- buttons ------------------------------------------------------------------------------------ */

.btn {
  border: 0;
  border-radius: 999px;
  padding: .7em 1.3em;
  font-weight: 700;
  min-height: 44px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .18);
  transition: transform .08s ease, filter .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-go { background: var(--green-deep); color: #fff; }
.btn-go:hover { filter: brightness(1.06); }
.btn-soft { background: #efe7d4; color: var(--ink); box-shadow: none; }
.btn-buy { background: var(--gold); color: var(--ink); }
.btn-sm { min-height: 34px; padding: .35em .9em; font-size: 13px; }

.icon-btn {
  border: 0;
  min-width: 44px;
  height: 44px;
  padding: 0 .9em;
  border-radius: 999px;
  background: rgba(255, 253, 248, .94);
  color: var(--ink);
  font-weight: 700;
  box-shadow: var(--shadow);
}
.pill {
  border: 0;
  border-radius: 999px;
  padding: .55em 1.1em;
  min-height: 40px;
  background: rgba(255, 253, 248, .94);
  font-weight: 700;
  box-shadow: var(--shadow);
}

/* ---- screens -------------------------------------------------------------------------------------- */

.screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
  z-index: 30;
}
#loading { background: linear-gradient(#6fb6e6, #cfe8f6); color: #fff; text-align: center; font-weight: 700; z-index: 40; }
#loading p { margin: .8em 0 0; text-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 5px solid rgba(255, 255, 255, .5);
  border-top-color: #fff;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

#auth { background: rgba(22, 40, 30, .28); backdrop-filter: blur(2px); overflow-y: auto; }
.auth-card {
  width: min(420px, 100%);
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 22px 18px;
}
.auth-logo { display: block; width: min(320px, 100%); height: auto; margin: 0 auto; image-rendering: pixelated; }
.auth-tag { text-align: center; color: var(--muted); margin: .4em 0 1em; }
.tabs { display: flex; gap: 6px; background: #f1e9d6; border-radius: 999px; padding: 4px; margin-bottom: 14px; }
.tab { flex: 1; border: 0; background: transparent; border-radius: 999px; padding: .55em; font-weight: 700; color: var(--muted); min-height: 40px; }
.tab[aria-selected="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
#auth-form { display: grid; gap: 12px; }
#auth-form label { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
#auth-form input:not([type="checkbox"]) {
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: .7em .85em;
  background: #fff;
  min-height: 46px;
  font-size: 16px;
}
#auth-form input:focus { outline: none; border-color: var(--green-deep); }
#auth-form .check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
#auth-form .check input { width: 20px; height: 20px; accent-color: var(--green-deep); }
.hint { margin: 0; color: var(--muted); font-size: 13px; }
.error { margin: 0; color: #a3261f; font-weight: 600; font-size: 14px; }
.auth-foot { text-align: center; color: var(--muted); font-size: 13px; margin: 14px 0 0; }
.auth-foot .downloads { display: block; }
#auth.is-login .join-only { display: none; }

/* ---- the HUD ---------------------------------------------------------------------------------------- */

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * > * { pointer-events: auto; }
.hud-top {
  position: absolute;
  left: 0; right: 0; top: 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: calc(10px + var(--safe-top)) calc(10px + var(--safe-right)) 0 calc(10px + var(--safe-left));
}
.me {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 253, 248, .94);
  border-radius: 999px;
  padding: 4px 16px 4px 4px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.me-face { width: 44px; height: 44px; border-radius: 50%; background: #e7f4ec; image-rendering: pixelated; }
.me-name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.wallet { display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.coin, .vb { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe28a, var(--gold) 60%, #b8862a); box-shadow: inset 0 0 0 1.5px #9a6e1e; }
.vb { border-radius: 4px; background: var(--green-deep); box-shadow: inset 0 0 0 1.5px var(--green-dark); margin-left: 8px; position: relative; }
.vb::after { content: "V"; position: absolute; inset: 0; color: #fff; font-size: 10px; font-weight: 900; line-height: 14px; text-align: center; }
.hud-mid { margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.sky-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 999px;
  padding: 3px 12px 3px 5px;
  min-height: 36px;
  background: rgba(255, 253, 248, .94);
  box-shadow: var(--shadow);
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
}
.sky-icon { width: 28px; height: 28px; image-rendering: pixelated; border-radius: 50%; background: #a9d6f0; padding: 1px; }
.sky-chip.night .sky-icon { background: #24345a; }
.sky-chip.dusk .sky-icon { background: #f4b183; }
.sky-chip .temp { color: var(--ink-soft); font-weight: 700; }
.sky-chip .temp::before { content: "·"; margin-right: 6px; color: var(--muted); }
#skyinfo { display: grid; gap: 2px; padding: 10px 14px; max-width: 280px; font-size: 14px; }
#skyinfo .hint { margin-top: 4px; }
.mail-btn { position: relative; display: inline-grid; place-items: center; padding: 0 10px; }
.mail-icon { width: 28px; height: 28px; image-rendering: pixelated; }
.mail-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e0457b;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
}
.mail-btn.ring { animation: ring .7s ease 2; }
.friends-btn { position: relative; }
.friends-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e0457b;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
}

/* ---- friends ------------------------------------------------------------------------------------- */

.friend-add { display: flex; gap: 8px; margin: 0 0 10px; }
.friend-add input { flex: 1; min-width: 0; border: 2px solid var(--line); border-radius: 10px; padding: .5em .8em; min-height: 40px; }
.friend-add input:focus { outline: none; border-color: var(--green-deep); }
.friend-lists { display: grid; gap: 8px; }
.friend-lists h3 { margin: 10px 0 0; font-size: 14px; color: var(--ink-soft); }
.friend-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; border: 2px solid var(--line); border-radius: 14px; background: #fff; padding: 6px 10px 6px 6px; }
.friend-row.waiting { grid-template-columns: 1fr auto; padding-left: 12px; }
.friend-row.online { border-color: var(--green-deep); background: #f1fbf5; }
.friend-row.asking { border-color: var(--gold); background: #fff8e6; }
.friend-face { width: 48px; height: 48px; border-radius: 10px; background: #efe7d4; image-rendering: pixelated; }
.friend-who { display: grid; min-width: 0; }
.friend-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-status { font-size: 13px; color: var(--muted); }
.friend-status .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: #b9b2a2; vertical-align: 0; }
.friend-row.online .friend-status { color: var(--green-dark); font-weight: 700; }
.friend-row.online .friend-status .dot { background: var(--green-deep); box-shadow: 0 0 0 3px rgba(23, 181, 102, .2); }
.friend-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 420px) {
  .friend-row { grid-template-columns: auto 1fr; }
  .friend-acts { grid-column: 1 / -1; justify-content: stretch; }
  .friend-acts .btn { flex: 1; }
}
@keyframes ring { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-14deg); } 40% { transform: rotate(12deg); } 60% { transform: rotate(-8deg); } 80% { transform: rotate(5deg); } }
.place {
  align-self: center;
  background: rgba(22, 21, 28, .72);
  color: #fff;
  border-radius: 999px;
  padding: .35em 1em;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}
.hud-buttons { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.hud-bottom {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 0 calc(10px + var(--safe-right)) calc(10px + var(--safe-bottom)) calc(10px + var(--safe-left));
}
.emotes { display: flex; gap: 8px; justify-content: flex-end; }
#hud .emotes { pointer-events: none; }          /* the row is screen-wide: only its buttons take taps */
#hud .emotes > * { pointer-events: auto; }
.chat {
  display: flex;
  gap: 8px;
  background: rgba(255, 253, 248, .96);
  border-radius: 999px;
  padding: 5px 5px 5px 16px;
  box-shadow: var(--shadow);
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}
.chat input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 16px; outline: none; }
/* the chat log over the bar (chatlog.js): the town's people green with their titles, like their name tags */
.chat-log {
  max-width: 640px; width: 100%; margin: 0 auto;
  background: rgba(255, 253, 248, .9); border-radius: 16px; box-shadow: var(--shadow);
  padding: 6px 4px 6px 12px;
}
.chat-lines { max-height: 138px; overflow-y: auto; overscroll-behavior: contain; padding-right: 8px; scrollbar-width: thin; }
.chat-line { margin: 0; padding: 2px 0; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; color: #2a2730; }
.chat-who { font-weight: 700; margin-right: 6px; color: #3a3542; }
.chat-who.mine { color: #16151c; }
.chat-who.town { display: inline-block; background: rgba(23, 181, 102, .92); color: #fff; border-radius: 999px; padding: 0 8px; margin-right: 4px; font-size: 13px; }
.chat-title { font-size: 12px; color: #17895a; font-weight: 600; margin-right: 6px; }
.chat-place { margin: 4px 0 2px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #8a8494; }
.chat-place:first-child { margin-top: 0; }
.chat-fold {
  flex: none; align-self: center; width: 34px; height: 34px; margin-left: -11px; border: 0; border-radius: 50%; cursor: pointer;
  background: #efe9dc center / 14px 10px no-repeat linear-gradient(#5a5464 0 2px, transparent 2px 4px, #5a5464 4px 6px, transparent 6px 8px, #5a5464 8px 10px);
  font: 700 12px/34px system-ui, sans-serif; color: #fff; padding: 0;
}
.chat-fold.open { background-color: #dff3e8; }
.chat-fold.news { background: #17b566; }
@media (max-width: 560px) { .chat-lines { max-height: 92px; } .chat-line { font-size: 13px; } }
@media (max-height: 520px) { .chat-lines { max-height: 64px; } }
/* on a narrow screen the clock sits under your name, out of the buttons' way */
@media (max-width: 820px) {
  .hud-mid { position: absolute; left: calc(10px + var(--safe-left)); top: calc(96px + var(--safe-top)); margin: 0; align-items: flex-start; }
}
@media (max-width: 560px) {
  .place { display: none; }
  .me-name { max-width: 30vw; }
  .sky-chip { font-size: 13px; }
  /* a phone: the buttons are one row under your name, swiped along, not stacked over it */
  .hud-top { flex-wrap: wrap; row-gap: 4px; }
  .hud-buttons { order: 3; flex: 1 0 100%; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none;
    padding: 6px 2px 8px; margin: 0 -2px; }
  .hud-buttons::-webkit-scrollbar { display: none; }
  .hud-buttons .icon-btn { flex: none; height: 38px; min-width: 38px; padding: 0 .75em; font-size: 14px; }
  .hud-buttons .mail-btn { padding: 0 6px; }
  .hud-buttons [data-act="menu"] { order: -1; }
}
/* a touch screen pinches to zoom */
@media (max-width: 560px) and (pointer: coarse) {
  .hud-buttons [data-act="zoomin"], .hud-buttons [data-act="zoomout"] { display: none; }
  .hud-mid { top: calc(150px + var(--safe-top)); }
}
@media (max-width: 400px) {
  .pocket .vb, .pocket .vbs, .pocket .bank-vbs { display: none; }
}

/* ---- Kassi's dialogue ------------------------------------------------------------------------------- */

#dialogue {
  position: fixed;
  left: 50%;
  bottom: calc(14px + var(--safe-bottom));
  transform: translateX(-50%);
  width: min(640px, calc(100% - 20px));
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px 12px 12px;
  z-index: 20;
  cursor: pointer;
  border: 3px solid var(--green-deep);
  animation: rise .25s ease;
}
@keyframes rise { from { transform: translate(-50%, 12px); opacity: 0; } }
.who-face { width: 72px; height: 72px; flex: none; border-radius: 14px; background: #e7f4ec; image-rendering: pixelated; }
.talk { flex: 1; min-width: 0; }
.who-name { font-size: 16px; }
.who-title { color: var(--green-dark); font-weight: 700; font-size: 13px; }
.line { margin: .3em 0 .2em; font-size: 16px; min-height: 2.8em; }
.next { text-align: right; color: var(--muted); font-size: 12px; font-weight: 700; }

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

#panel {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(22, 21, 28, .25);
}
#panel.no-dim { background: transparent; pointer-events: none; }
#panel.no-dim .sheet { pointer-events: auto; }
.sheet {
  position: relative;
  width: 100%;
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow);
  padding-bottom: var(--safe-bottom);
  animation: sheet .22s ease;
}
@keyframes sheet { from { transform: translateY(24px); opacity: 0; } }
.sheet .close { position: absolute; top: 10px; right: 10px; z-index: 2; box-shadow: none; background: #efe7d4; }
.sheet-body { overflow-y: auto; padding: 18px 16px 16px; }
.sheet h2 { margin: 0 44px 4px 0; font-size: 20px; }
.sheet .lead { margin: 0 0 12px; color: var(--muted); }
@media (min-width: 760px) {
  #panel { align-items: center; }
  .sheet { width: min(860px, 94vw); max-height: 86vh; border-radius: var(--radius); }
  #panel.side { justify-content: flex-end; padding-right: 16px; }
  #panel.side .sheet { width: min(540px, 50vw); }
}

/* the creator and the shop: a big preview beside the choices */
.studio { display: grid; gap: 14px; grid-template-columns: 1fr; }
.studio > *, .giftbench > *, .composer > * { min-width: 0; }   /* a long row of chips scrolls instead of widening the panel */
.preview { display: grid; justify-items: center; gap: 8px; background: linear-gradient(#e7f4ec, #fbf6ea); border-radius: 16px; padding: 10px; }
.preview canvas { image-rendering: pixelated; width: 156px; height: 264px; }
.preview .turn { display: flex; gap: 8px; }
@media (min-width: 760px) {
  .studio { grid-template-columns: 240px 1fr; align-items: start; }
  .preview { position: sticky; top: 0; }
  .preview canvas { width: 208px; height: 352px; }
  /* beside the town, the panel is narrower: a smaller figure leaves the choices room */
  #panel.side .studio { grid-template-columns: 136px 1fr; }
  #panel.side .preview canvas { width: 104px; height: 176px; }
  #panel.side .preview .turn { flex-direction: column; }
}
@media (max-width: 759px) and (orientation: landscape) {
  .studio { grid-template-columns: 170px 1fr; }
  .preview canvas { width: 104px; height: 176px; }
}
.section { margin: 0 0 14px; }
.section h3 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 2px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: .45em .9em;
  font-weight: 600;
  min-height: 38px;
}
.chip[aria-pressed="true"] { border-color: var(--green-deep); background: #e5f7ec; color: var(--green-dark); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--line);
  padding: 0;
}
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--green-deep); }
.steps { display: flex; flex-wrap: wrap; gap: 4px; }
.steps .chip { flex: 1 0 auto; padding: .45em .5em; font-size: 13px; }
.tabs-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: none; }
.tabs-row .chip { white-space: nowrap; }
/* the creator's picture grids: hair styles, facial hair (creator.js) */
.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; max-height: 300px; overflow-y: auto; padding: 2px; }
.pick { display: grid; justify-items: center; gap: 2px; padding: 4px 2px; border: 2px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; font: inherit; font-size: 11px; line-height: 1.15; }
.pick canvas { width: 56px; height: 56px; image-rendering: pixelated; }
.pick[aria-pressed="true"] { border-color: #17b566; box-shadow: 0 0 0 2px rgba(23, 181, 102, .3); }
/* the shop's style picker, search and filters (shop.js) */
.styles-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; scrollbar-width: thin; }
.styles-row .chip { white-space: nowrap; font-size: 13px; }
.search-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.shop-search { flex: 1 1 160px; min-width: 0; border: 2px solid var(--line); border-radius: 999px; padding: .45em .9em; font: inherit; background: #fff; }
.filters-row { display: flex; gap: 6px; flex-wrap: wrap; }
.filters-row .chip { font-size: 13px; }
.shop-count { margin: 2px 0 8px; }
.items + .more { display: block; margin: 10px auto 0; }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }

.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.item {
  display: grid;
  justify-items: center;
  gap: 2px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 6px 6px 8px;
  text-align: center;
  min-height: 150px;
}
.item canvas { width: 52px; height: 88px; image-rendering: pixelated; }
.item[aria-pressed="true"] { border-color: var(--green-deep); background: #f1fbf5; }
.item .name { font-weight: 700; font-size: 13px; line-height: 1.2; }
.price { font-size: 12px; font-weight: 700; color: var(--ink-soft); display: flex; align-items: center; gap: 4px; }
.price.owned { color: var(--green-dark); }
.price.locked { color: var(--muted); }

/* the rules */
.rules ol { padding-left: 1.3em; margin: .4em 0 1em; }
.rules li { margin: .35em 0; }
.rules ul { padding-left: 1.2em; margin: .3em 0 1em; color: var(--ink-soft); }
.rules .agree { display: flex; gap: 10px; align-items: center; font-weight: 700; margin: 6px 0 4px; }
.rules .agree input { width: 22px; height: 22px; accent-color: var(--green-deep); }

/* ---- popovers and notices ------------------------------------------------------------------------------ */

.popover {
  position: fixed;
  z-index: 28;
  display: grid;
  gap: 4px;
  background: var(--panel);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 6px;
  min-width: 170px;
}
.popover button { border: 0; background: transparent; text-align: left; padding: .7em .9em; border-radius: 10px; font-weight: 600; min-height: 44px; }
.popover button:hover { background: #f1e9d6; }
#menu { top: calc(62px + var(--safe-top)); right: calc(10px + var(--safe-right)); }
.person-name { font-weight: 800; padding: .4em .9em 0; }

#toasts {
  position: fixed;
  left: 50%;
  top: calc(70px + var(--safe-top));
  transform: translateX(-50%);
  display: grid;
  gap: 6px;
  z-index: 35;
  pointer-events: none;
  width: min(520px, calc(100% - 24px));
}
.toast {
  background: rgba(22, 21, 28, .88);
  color: #fff;
  border-radius: 14px;
  padding: .6em 1em;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow);
  animation: rise2 .2s ease;
}
.toast.big { background: var(--green-deep); font-size: 17px; }
@keyframes rise2 { from { transform: translateY(-8px); opacity: 0; } }

/* ---- the Post Office ------------------------------------------------------------------------------------ */

.field {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: .6em .8em;
  background: #fff;
  font-size: 16px;
  resize: vertical;
}
.field:focus { outline: none; border-color: var(--green-deep); }
.field:disabled { background: #f3eee2; color: var(--ink-soft); }
.hint.center { text-align: center; }
.link { border: 0; background: none; padding: .4em .2em; color: var(--muted); font-weight: 600; text-decoration: underline; }
.more { display: flex; gap: 14px; justify-content: flex-end; margin-top: 4px; }
.back { margin-bottom: 10px; }
.confirm { border: 2px solid var(--line); background: #fbf6ea; border-radius: 14px; padding: 10px 12px; margin-top: 10px; }
.confirm p { margin: 0 0 6px; font-weight: 600; }

.mail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-right: 44px; }
.tabs-row .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #e0457b; margin-left: 6px; vertical-align: middle; }
.letters { display: grid; gap: 8px; }
.letters .empty { color: var(--muted); text-align: center; padding: 18px 0; margin: 0; }
.letter {
  display: grid;
  grid-template-columns: 76px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 6px 10px 6px 6px;
  text-align: left;
}
.letter.unread { border-color: var(--green-deep); background: #f3fbf6; }
.letter:hover { filter: brightness(.98); }
.thumb { width: 72px; height: 48px; object-fit: contain; image-rendering: pixelated; border-radius: 6px; justify-self: center; }
.thumb.card { box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.thumb.gift { width: 40px; height: 48px; }
.thumb.emblem { width: 40px; height: 40px; }
.letter-text { display: grid; min-width: 0; }
.letter-text .kind { font-size: 12px; font-weight: 700; color: var(--green-dark); }
.letter-text .snippet { color: var(--ink-soft); font-size: 13px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.letter.unread .letter-text b::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #e0457b; margin-left: 6px; vertical-align: middle; }
.when { font-size: 12px; color: var(--muted); white-space: nowrap; align-self: start; padding-top: 4px; }
@media (max-width: 420px) { .when { display: none; } .letter { grid-template-columns: 64px 1fr; } }

.reading { display: grid; gap: 12px; justify-items: center; }
.from { display: flex; align-items: center; gap: 10px; justify-self: stretch; }
.from > div { display: grid; }
.from span { font-size: 13px; color: var(--muted); }
.who-pic { width: 44px; height: 44px; border-radius: 50%; background: #e7f4ec; image-rendering: pixelated; flex: none; }

/* a postcard: its picture on the front, the message, stamp and postmark on the back; tap to turn it */
.postcard { position: relative; width: min(480px, 100%); aspect-ratio: 3 / 2; perspective: 1200px; cursor: pointer; }
.pc-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(22, 21, 28, .25);
  transition: transform .6s cubic-bezier(.3, .7, .3, 1);
}
.pc-front-img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.pc-back {
  transform: rotateY(180deg);
  background: #fbf7ec;
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  padding: 14px;
  gap: 12px;
}
.postcard.flipped .pc-front { transform: rotateY(-180deg); }
.postcard.flipped .pc-back { transform: rotateY(0deg); }
.pc-message {
  border-right: 2px solid #e2d8c2;
  padding-right: 12px;
  font-family: "Segoe Print", "Bradley Hand", "Chalkboard SE", "Marker Felt", "Comic Sans MS", cursive;
  font-size: 15px;
  line-height: 1.45;
  color: #2a3a6a;
  overflow-wrap: anywhere;
  overflow: hidden;
}
.pc-message p { margin: 0 0 .4em; }
.pc-sign { text-align: right; }
.pc-address { position: relative; display: grid; align-content: end; }
.pc-stamp { position: absolute; top: 0; right: 0; width: 48px; height: 60px; image-rendering: pixelated; transform: rotate(3deg); }
.postmark {
  position: absolute;
  top: 18px;
  right: 34px;
  width: 64px;
  height: 64px;
  border: 2px solid rgba(60, 60, 70, .55);
  border-radius: 50%;
  display: grid;
  place-content: center;
  text-align: center;
  color: rgba(60, 60, 70, .7);
  font-size: 7px;
  font-weight: 800;
  line-height: 1.2;
  transform: rotate(-14deg);
}
.postmark b { font-size: 8px; }
.pc-lines { display: grid; gap: 6px; font-family: "Segoe Print", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", cursive; color: #2a3a6a; font-size: 13px; }
.pc-lines span { border-bottom: 1.5px solid #d8cdb4; padding-bottom: 2px; min-height: 1.3em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.postcard.small { width: 100%; }
.postcard.small .pc-message { font-size: 12px; }
@media (max-width: 420px) {
  .pc-back { grid-template-columns: 1fr; padding: 10px; }
  .pc-message { border-right: 0; padding-right: 0; font-size: 13px; }
  .pc-address .pc-lines, .postmark { display: none; }
  .pc-stamp { width: 36px; height: 45px; }
}

.paper-letter { width: min(480px, 100%); background: #fbf7ec; border-radius: 10px; box-shadow: 0 6px 18px rgba(22, 21, 28, .18); padding: 16px 18px; }
.letterhead { display: flex; gap: 10px; align-items: center; border-bottom: 2px solid #e2d8c2; padding-bottom: 10px; margin-bottom: 10px; }
.letterhead > div { display: grid; }
.letterhead span { font-size: 13px; color: var(--muted); }
.letterhead .who-pic { width: 48px; height: 48px; }
.paper-letter p { margin: 0; line-height: 1.55; }

/* a gift: the box, its tag, and what was inside once it's open */
.gift-stage { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; }
.gift-big { width: 160px; height: 200px; image-rendering: pixelated; }
.gift-big.shake { animation: shake .45s ease infinite; }
@keyframes shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-4deg) translateY(-2px); } 75% { transform: rotate(4deg) translateY(-2px); } }
.gift-tag {
  display: grid;
  gap: 2px;
  background: #fbf7ec;
  border: 2px solid #e2d8c2;
  border-radius: 6px 14px 14px 6px;
  padding: 10px 14px 10px 22px;
  max-width: 240px;
  position: relative;
  font-family: "Segoe Print", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", cursive;
  color: #2a3a6a;
}
.gift-tag::before { content: ""; position: absolute; left: 7px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; border: 2px solid #c9bfa6; background: var(--panel); }
.gift-tag p { margin: 4px 0 0; font-size: 14px; }
.inside { display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap; }
.inside > div { display: grid; gap: 4px; justify-items: start; }
.inside-pic { width: 104px; height: 176px; image-rendering: pixelated; background: linear-gradient(#e7f4ec, #fbf6ea); border-radius: 14px; }
.coins-in { display: flex !important; align-items: center; gap: 6px; flex-wrap: wrap; max-width: 260px; }
.coins-in .coin { width: 22px; height: 22px; }

/* writing a postcard */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.card-pick { border: 3px solid transparent; border-radius: 10px; padding: 0; background: none; line-height: 0; }
.card-pick canvas { width: 100%; height: auto; border-radius: 6px; image-rendering: pixelated; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }
.card-pick[aria-pressed="true"] { border-color: var(--green-deep); }
.stamp-row { display: flex; flex-wrap: wrap; gap: 8px; }
.stamp-pick { border: 3px solid transparent; border-radius: 8px; padding: 2px; background: none; line-height: 0; }
.stamp-pick canvas { width: 36px; height: 45px; image-rendering: pixelated; }
.stamp-pick[aria-pressed="true"] { border-color: var(--green-deep); background: #e5f7ec; }
.section h3 .count { float: right; text-transform: none; letter-spacing: 0; font-weight: 600; }
.composer { display: grid; gap: 14px; }
@media (min-width: 640px) { .composer { grid-template-columns: 1fr 1fr; align-items: start; } }

/* wrapping a gift */
.giftbench { display: grid; gap: 14px; }
.gift-preview { display: grid; justify-items: center; gap: 6px; background: linear-gradient(#fdf3e6, #fbf6ea); border-radius: 16px; padding: 12px; }
.gift-preview .hint { text-align: center; }
@media (min-width: 640px) {
  .giftbench { grid-template-columns: 200px 1fr; align-items: start; }
  .gift-preview { position: sticky; top: 0; }
}
.gift-items { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.gift-items .item { min-height: 132px; }
.items > .hint { grid-column: 1 / -1; }
.coin-line { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-weight: 700; flex-wrap: wrap; }
.coin-field { width: 110px; }
.section .swatches { margin-top: 8px; }

/* Mabel at the counter */
.npc-head { display: flex; align-items: center; gap: 12px; margin: 0 44px 8px 0; }
.npc-head > div { display: grid; }
.npc-head span { color: var(--green-dark); font-weight: 700; font-size: 13px; }
.npc-face { width: 64px; height: 64px; border-radius: 14px; background: #e7f4ec; image-rendering: pixelated; }
.menu-list { display: grid; gap: 6px; }
.menu-list button { border: 2px solid var(--line); background: #fff; border-radius: 12px; text-align: left; padding: .75em 1em; font-weight: 700; min-height: 48px; }
.menu-list button:hover { border-color: var(--green-deep); }
.blocked { display: grid; gap: 6px; }
.blocked-row { display: flex; justify-content: space-between; align-items: center; border: 2px solid var(--line); border-radius: 12px; padding: 6px 6px 6px 12px; font-weight: 700; }

/* apartments: furniture, Decorate, Ken's store */
.decorate-btn.on { background: var(--green-deep); color: #fff; }
.piece-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.piece {
  display: grid; justify-items: center; align-content: start; gap: 2px; min-height: 132px;
  border: 2px solid var(--line); border-radius: 14px; background: #fff; padding: 8px 6px; text-align: center;
}
.piece:hover { border-color: var(--green-deep); }
.piece b { font-size: 13px; line-height: 1.2; }
.piece span { font-size: 12px; color: var(--muted); line-height: 1.25; }
.piece.short { opacity: .62; }
.piece .vb-price { color: var(--green-dark); font-weight: 700; }
.piece-icon { image-rendering: pixelated; }
.piece-big { display: flex; align-items: center; gap: 14px; margin: 6px 0 10px; }
.piece-big .piece-icon { background: #f3ede0; border-radius: 16px; flex: none; }
.piece-big h2 { margin: 0 0 6px; }
.chip .dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); }
.mats { display: flex; flex-wrap: wrap; gap: 6px; }
.mat { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 999px; background: #f3ede0; font-size: 13px; font-weight: 600; }
.mat i { width: 16px; height: 16px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18); }
.mat.short { background: #fbe3e3; color: #a3261f; }
.sheet h3 { margin: 14px 0 6px; font-size: 14px; }
.check { display: flex; align-items: center; gap: 8px; margin: 12px 0 4px; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--green-deep); }
.materials { display: grid; gap: 8px; }
.material { display: grid; grid-template-columns: 34px 1fr; gap: 6px 10px; align-items: center; border: 2px solid var(--line); border-radius: 14px; padding: 10px; }
.mat-swatch { width: 34px; height: 34px; border-radius: 10px; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .15); }
.material .about { display: grid; gap: 1px; }
.material .about span { font-size: 13px; color: var(--muted); }
.material .about .have { color: var(--green-dark); font-weight: 700; }
.material .buy { grid-column: 1 / -1; display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.material .buy .btn { padding: .4em .8em; min-height: 36px; font-size: 13px; }
.layouts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.layout { display: grid; gap: 4px; justify-items: start; text-align: left; border: 2px solid var(--line); border-radius: 16px; background: #fff; padding: 10px; }
.layout:hover { border-color: var(--green-deep); }
.layout span { font-size: 13px; color: var(--muted); }
.layout-pic { width: 100%; height: auto; border-radius: 10px; background: #1e2430; image-rendering: pixelated; }
.row-form { display: flex; gap: 8px; margin: 6px 0 10px; }
.row-form input { flex: 1; min-width: 0; border: 2px solid var(--line); border-radius: 12px; padding: .55em .8em; font: inherit; background: #fff; }
.row-form input:focus { outline: none; border-color: var(--green-deep); }
.stations { display: grid; gap: 6px; margin: 10px 0; max-height: 40vh; overflow-y: auto; }
.station { display: grid; text-align: left; gap: 1px; border: 2px solid var(--line); border-radius: 12px; background: #fff; padding: .55em .9em; }
.station:hover { border-color: var(--green-deep); }
.station span { font-size: 12px; color: var(--muted); }
.now-playing { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #e5f7ec; border-radius: 14px; padding: 10px 12px; margin-bottom: 10px; }
.now-playing span { font-size: 12px; font-weight: 700; color: var(--green-dark); text-transform: uppercase; letter-spacing: .04em; }
.now-playing b { flex: 1; min-width: 0; }

/* the bar along the bottom while decorating */
#editbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end;
  background: rgba(255, 253, 248, .97); border-radius: 18px; box-shadow: var(--shadow); padding: 8px 10px;
  width: 100%; max-width: 720px; margin: 0 auto;
  pointer-events: auto;
}
#editbar .what { flex: 1 1 140px; min-width: 0; }
#editbar .what.hint { font-size: 13px; }
#editbar .btn { min-height: 40px; padding: .45em .9em; }
#editbar .square { width: 40px; padding: 0; }
#editbar .piece-icon { width: 40px; height: 40px; background: #f3ede0; border-radius: 10px; }
body.decorating .chat, body.decorating .chat-log, body.decorating .emotes { display: none; }

/* the room's music */
#music {
  position: fixed; left: calc(12px + var(--safe-left)); bottom: calc(84px + var(--safe-bottom)); z-index: 18;
  width: min(356px, calc(100vw - 24px)); background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden;
}
.music-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; }
.music-what { flex: 1; min-width: 0; display: grid; }
.music-what b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-what span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#music iframe { display: block; width: 100%; height: 200px; border: 0; background: #000; }
.music-tap { display: block; width: calc(100% - 16px); margin: 0 8px 8px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---- the police: a held citizen's dark screen, their time in a cell, the citation ---------------- */
#fade {
  position: fixed; inset: 0; z-index: 19; background: #05060a; opacity: 0; pointer-events: none;
  display: grid; place-items: center; transition: opacity .9s ease;
}
#fade.on { opacity: 1; }
#fade .fade-text { color: #f4f1ea; font-size: 20px; font-weight: 800; letter-spacing: .02em; opacity: 0; transition: opacity .6s ease; margin: 0 16px; text-align: center; }
#fade.wake .fade-text { opacity: 1; }
.jail-chip {
  pointer-events: auto; border: 0; border-radius: 999px; padding: .35em 1em; min-height: 32px;
  background: #24345a; color: #fff; font-weight: 800; font-size: 13px; white-space: nowrap; box-shadow: var(--shadow);
}
.citation { border: 2px solid #24345a; border-radius: 14px; padding: 12px 14px; display: grid; gap: 6px; background: #f6f3ea; }
.citation b { color: #24345a; }
.police-form { display: grid; gap: 12px; }
.police-form h3 { margin: 0; font-size: 14px; color: var(--ink-soft); }
.police-form input { width: 100%; box-sizing: border-box; border: 2px solid var(--line); border-radius: 12px; padding: .6em .8em; font: inherit; }

/* ---- the bag ------------------------------------------------------------------------------------- */
.bag-pic { width: 52px; height: 88px; image-rendering: pixelated; }
.bag-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; margin: 8px 0 12px; }
.bag-slot { position: relative; border: 2px solid var(--line); border-radius: 12px; background: #fff; min-height: 84px; display: grid; justify-items: center; align-content: center; gap: 2px; padding: 6px 4px; }
.bag-slot.empty { background: #f4efe2; border-style: dashed; }
.bag-slot .item-icon { width: 40px; height: 40px; image-rendering: pixelated; }
.bag-slot b { position: absolute; top: 4px; right: 6px; font-size: 13px; }
.bag-slot span { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.2; }

/* Donna's Pet Pause, and your pets (pets.js) */
.pet-thumb { image-rendering: pixelated; }
.items.pets { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
.item.pet { min-height: 0; align-content: start; }
.item.pet canvas { width: 96px; height: 64px; }
.items.pets.breeds .item.pet { padding-bottom: 6px; }
.tag { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; }
.tag.follows { background: #e5f7ec; color: var(--green-dark); }
.tag.homebody { background: #f6eedc; color: #8a6a2a; }
.pet-pick { display: flex; gap: 12px; align-items: center; margin: 4px 0 10px; }
.pet-pick > div { display: grid; gap: 4px; justify-items: start; }
.pet-pick .hint { margin: 0; }
.pet-name { display: grid; gap: 4px; font-weight: 700; margin: 10px 0 6px; }
.pet-name input, .pet-rename input { border: 2px solid var(--line); border-radius: 10px; padding: .55em .8em; font: inherit; min-height: 40px; }
.pet-name input:focus, .pet-rename input:focus { outline: none; border-color: var(--green-deep); }
.pet-list { display: grid; gap: 8px; }
.pet-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; border: 2px solid var(--line); border-radius: 14px; background: #fff; padding: 6px 10px 6px 6px; }
.pet-row.out { border-color: var(--green-deep); background: #f1fbf5; }
.pet-row canvas { width: 96px; height: 64px; }
.pet-about { display: grid; }
.pet-about span { font-size: 13px; color: var(--ink-soft); }
.pet-about .hint { margin: 0; }
.pet-buttons { display: grid; gap: 6px; }
.pet-rename { display: flex; gap: 6px; }
.pet-rename input { min-width: 0; width: 9em; }
@media (max-width: 420px) {
  .pet-row { grid-template-columns: auto 1fr; }
  .pet-buttons { grid-column: 1 / -1; display: flex; flex-wrap: wrap; }
}

/* trading (trade.js) */
.trade h3 { margin: 14px 0 6px; font-size: 15px; }
.trade-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.trade-side { border: 2px solid var(--line); border-radius: 14px; background: #fff; padding: 8px; display: grid; gap: 6px; align-content: start; }
.trade-side.ready { border-color: var(--green-deep); background: #f1fbf5; }
.trade-side .hint { margin: 0; }
.trade-things { display: grid; gap: 4px; }
.trade-thing { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; text-align: left;
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff; padding: 4px 8px 4px 4px; font: inherit; font-size: 13px; font-weight: 700; min-height: 44px; }
button.trade-thing { cursor: pointer; }
button.trade-thing:hover { border-color: var(--green-deep); }
.trade-thing > :first-child { grid-row: 1 / 3; }
.trade-thing small { display: flex; align-items: center; gap: 3px; font-size: 11px; color: var(--ink-soft); font-weight: 600; }
.trade-thing canvas.pet-thumb { width: 48px !important; height: 32px !important; }
.trade-thing canvas.trade-clothes { width: 26px; height: 44px; image-rendering: pixelated; }
.trade-thing .item-icon { width: 32px; height: 32px; image-rendering: pixelated; }
.trade-worth { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--ink-soft); border-top: 1px dashed var(--line); padding-top: 6px; }
.trade-worth > span:first-child { margin-right: 2px; }
.trade-status { min-height: 1.2em; margin: 6px 0 0; font-weight: 700; color: var(--green-dark); font-size: 13px; }
.trade-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.trade-pick > .hint, .trade-pick > .btn { grid-column: 1 / -1; justify-self: start; }
.trade-money { display: grid; gap: 4px; font-weight: 700; font-size: 13px; grid-column: span 1; }
.trade-money input { border: 2px solid var(--line); border-radius: 10px; padding: .5em .7em; font: inherit; min-height: 40px; }
.coin.big, .vb.big { width: 22px; height: 22px; }
@media (max-width: 420px) { .trade-sides { grid-template-columns: 1fr; } }

/* the Community Job Board (jobs.js) */
.job-chip {
  pointer-events: auto; border: 0; border-radius: 999px; padding: .35em 1em; min-height: 32px; max-width: 70vw;
  background: #c46a3b; color: #fff; font-weight: 800; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: var(--shadow);
}
.pill-go { background: var(--green-deep); color: #fff; }
/* fishing (fishing.js): Cast, then Reel in!, bouncing when a fish bites */
.fish-pill.biting { background: #d9342b; color: #fff; animation: bite .32s ease-in-out infinite alternate; }
.fish-pill.waiting { opacity: .8; }
@keyframes bite { from { transform: translateY(0) scale(1); } to { transform: translateY(-3px) scale(1.06); } }
.fish-list { display: grid; gap: 6px; margin: 8px 0 12px; }
.fish-row { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px; padding: 6px 10px; border: 2px solid var(--line); border-radius: 12px; background: #fff; }
.fish-row .item-icon { width: 32px; height: 32px; image-rendering: pixelated; }
.fish-row b { font-size: 14px; }
.fish-row span { font-size: 12px; color: var(--muted); }
.fish-row.junk { opacity: .7; }
.fish-row.rare { border-color: #e0a020; background: #fff8e0; }
.mat .item-icon { width: 16px; height: 16px; image-rendering: pixelated; }
/* basketball (hoops.js): Shoot is held, the meter sweeps while it is */
.shoot-pill { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.shot-meter {
  position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); display: grid; justify-items: center; gap: 6px;
  pointer-events: none; z-index: 5;
}
.shot-meter[hidden] { display: none; }
.shot-meter .cap {
  padding: 3px 12px; border-radius: 999px; background: rgba(22, 21, 28, .78); color: #fff; font-size: 13px; font-weight: 800;
}
.shot-meter .track {
  position: relative; width: min(340px, 78vw); height: 24px; border-radius: 999px; background: rgba(22, 21, 28, .86);
  box-shadow: var(--shadow), inset 0 0 0 2px rgba(255, 255, 255, .22);
}
.shot-meter i { position: absolute; top: 4px; bottom: 4px; }
.shot-meter .zone { background: #17b566; border-radius: 5px; }
.shot-meter .sweet { background: #b6f7cf; border-radius: 5px; }
.shot-meter .needle { top: -5px; bottom: -5px; width: 6px; margin-left: -3px; background: #fff; border-radius: 3px; box-shadow: 0 0 0 2px #16151c; }
.job-list { display: grid; gap: 8px; }
.job-card { border: 2px solid var(--line); border-radius: 14px; background: #fff; padding: 10px 12px; display: grid; gap: 4px; }
.job-card.mine { border-color: var(--green-deep); background: #f1fbf5; }
.job-card.closed { opacity: .62; }
.job-card p { margin: 2px 0; font-size: 13px; line-height: 1.35; }
.job-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.job-for { font-size: 12px; font-weight: 700; color: var(--green-dark); }
.job-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.job-foot .btn { margin-left: auto; }
.job-how { font-weight: 600; }

/* businesses (business.js) */
.voucher { display: grid; gap: 8px; }
.voucher h3 { margin: 6px 0 0; }
.field { display: grid; gap: 4px; font-weight: 700; font-size: 13px; }
.field input, .field textarea { border: 2px solid var(--line); border-radius: 10px; padding: .55em .8em; font: inherit; font-weight: 400; min-height: 40px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--green-deep); }
.field-label { font-weight: 700; font-size: 13px; margin: 8px 0 4px; }
label.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.35; margin: 8px 0; }
label.check input { width: 20px; height: 20px; flex: none; accent-color: var(--green-deep); }
.kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.kind { border: 2px solid var(--line); border-radius: 12px; background: #fff; padding: 8px 10px; text-align: left; display: grid; gap: 2px; font: inherit; cursor: pointer; }
.kind span { font-size: 12px; color: var(--ink-soft); line-height: 1.3; }
.kind[aria-pressed="true"] { border-color: var(--green-deep); background: #f1fbf5; }
.shop-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; border: 2px solid var(--line); border-radius: 12px; background: #fff; padding: 8px 10px; margin-bottom: 6px; }
.shop-row .btn { margin-left: auto; }
.meter { flex: 1 1 80px; height: 10px; border-radius: 999px; background: #eee6d4; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--green-deep); }
.meter span.low { background: #c0392b; }
.stock-list { display: grid; gap: 6px; }
.stock-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; border: 2px solid var(--line); border-radius: 12px; background: #fff; padding: 6px 10px 6px 6px; }
.stock-row > div { display: grid; }
.stock-row .hint { margin: 0; font-size: 12px; }
.price-field { display: grid; gap: 2px; font-size: 11px; font-weight: 700; }
.price-field input { width: 4.5em; border: 2px solid var(--line); border-radius: 8px; padding: .3em .5em; font: inherit; }
.good-icon { width: 32px; height: 32px; image-rendering: pixelated; }
@media (max-width: 420px) { .stock-row { grid-template-columns: auto 1fr; } .stock-row > :nth-child(n+3) { grid-column: span 1; } }

/* the Bank of Vanilla (bank.js) */
.bank-total { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 2px solid #c9a23a; border-radius: 12px;
  background: #fbf6e6; padding: 8px 12px; margin-bottom: 8px; font-weight: 800; }
.bank-row { display: grid; gap: 6px; border: 2px solid var(--line); border-radius: 12px; background: #fff; padding: 8px 10px; margin-bottom: 6px; }
.bank-sums { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--ink-soft); }
.bank-move { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bank-move input { width: 6em; border: 2px solid var(--line); border-radius: 10px; padding: .4em .6em; font: inherit; min-height: 36px; }
.bank-two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bank-fee { min-height: 1.2em; font-weight: 700; color: #8a5a1a; font-size: 13px; margin: 6px 0; }
.bank-statement { display: grid; gap: 4px; }
.bank-line { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; border-bottom: 1px dashed var(--line); padding: 6px 2px; font-size: 13px; }
.bank-line .hint { margin: 0; grid-column: 1 / -1; font-size: 12px; }

/* your money under your name: the wallet pocket and, once you have an account, the bank's */
.money { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; margin-top: 3px; }
.me:has(.pocket-bank:not([hidden])) { border-radius: 28px; padding: 6px 14px 6px 6px; }
.pocket { display: inline-flex; align-items: center; gap: 4px; height: 22px; min-width: 96px; padding: 0 9px 0 6px; border-radius: 999px;
  background: #f3eee2; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06); font-size: 13px; font-weight: 800; color: var(--ink); white-space: nowrap; }
.pocket[hidden] { display: none; }
.pocket .vb { margin-left: 6px; }
.pocket-icon { width: 16px; height: 16px; flex: none; }
.pocket-bank { background: #e3f2e9; color: #1f4a3a; box-shadow: inset 0 0 0 1px rgba(31, 74, 58, .18); }
.money-pop { position: fixed; z-index: 60; transform: translate(-50%, -4px); font-weight: 900; font-size: 13px; pointer-events: none;
  text-shadow: 0 1px 0 #fff, 0 0 4px rgba(255, 255, 255, .9); animation: money-pop 1.5s ease-out forwards; }
.money-pop.up { color: #12844a; }
.money-pop.down { color: #b23a2a; }
@keyframes money-pop { 0% { opacity: 0; transform: translate(-50%, 2px); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -26px); } }
@media (prefers-reduced-motion: reduce) { .money-pop { animation: none; opacity: 0; } }
/* the game view (gameview.js): a game up close over the town, the pool table from above, the Skee-Ball
   lane, a cabinet's screen: a bar at the top, the game's canvas, its buttons along the bottom */
#gameview {
  position: fixed; inset: 0; z-index: 15; display: grid; grid-template-rows: auto 1fr auto;
  background: radial-gradient(ellipse at 50% 40%, #2a2350 0%, #120e22 75%); color: #fff;
  padding: calc(var(--safe-top) + 8px) calc(var(--safe-right) + 10px) calc(var(--safe-bottom) + 10px) calc(var(--safe-left) + 10px);
}
.gv-top { display: flex; align-items: flex-start; gap: 10px; }
.gv-head { flex: 1; display: grid; gap: 6px; min-width: 0; }
.gv-title { font-size: 17px; font-weight: 900; color: #5fffa8; }
.gv-info { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13px; }
.gv-close { flex: none; }
.gv-stage { position: relative; min-height: 0; }
.gv-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.gv-bottom { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; min-height: 44px; }
.gv-bottom .pill, .gv-top .pill { background: rgba(255, 255, 255, .14); color: #fff; box-shadow: none; }
.gv-bottom .pill-go, .gv-top .pill-go { background: var(--green-deep); }
.gv-shoot { min-width: 130px; font-size: 17px; touch-action: none; user-select: none; -webkit-user-select: none; }
.gv-nudge { min-width: 52px; touch-action: none; user-select: none; -webkit-user-select: none; }
/* pool (pool.js): the table's bar at the top, Shoot held with the power meter climbing and falling */
.pool-bar {
  position: fixed; left: 50%; top: calc(var(--safe-top) + 74px); transform: translateX(-50%); z-index: 4;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; max-width: min(640px, 94vw);
  padding: 8px 12px; border-radius: 16px; background: rgba(22, 21, 28, .84); color: #fff; font-size: 13px; box-shadow: var(--shadow);
}
.pool-title { font-weight: 800; color: #5fffa8; }
.pool-seat { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, .08); }
.pool-seat.up { background: #17b566; }
.pool-seat.won { background: #c9a23a; }
.pool-seat em { font-style: normal; font-size: 11px; opacity: .85; }
.pool-note { width: 100%; text-align: center; font-size: 12px; opacity: .85; }
.pool-btns { display: inline-flex; gap: 6px; }
.pool-btns .pill { min-height: 30px; padding: .2em .9em; font-size: 13px; background: rgba(255, 255, 255, .16); color: #fff; box-shadow: none; }
.pool-btns .pill-go { background: var(--green-deep); }
.pool-note-inline { font-size: 13px; opacity: .9; }
.pool-mode { font-weight: 800; color: #f2e45a; }
.pool-clock { font-style: normal; font-weight: 800; color: #ffd84a; }
.pool-balls { display: inline-flex; gap: 2px; }
.pb { width: 11px; height: 11px; border-radius: 50%; box-shadow: 0 0 0 1px #16151c; display: inline-block; }
.pb1, .pb9 { --c: #f2c430; } .pb2, .pb10 { --c: #2f5fd0; } .pb3, .pb11 { --c: #d9342b; } .pb4, .pb12 { --c: #6a3ab8; }
.pb5, .pb13 { --c: #ef7a1a; } .pb6, .pb14 { --c: #1f8a46; } .pb7, .pb15 { --c: #8a2430; } .pb8 { --c: #16151c; }
.pb1, .pb2, .pb3, .pb4, .pb5, .pb6, .pb7, .pb8 { background: var(--c); }
.pb9, .pb10, .pb11, .pb12, .pb13, .pb14, .pb15 { background: linear-gradient(#f6f3ea 28%, var(--c) 28% 72%, #f6f3ea 72%); }
/* the arcade (arcade.js): tickets in the HUD, Benny's prizes */
.ticket-chip {
  pointer-events: auto; border-radius: 999px; padding: .3em .9em; min-height: 30px; display: inline-flex; align-items: center;
  background: #2b2452; color: #f2e45a; font-weight: 900; font-size: 14px; box-shadow: var(--shadow), inset 0 0 0 2px #ff5fb0;
}
.ticket-chip.pop { animation: ticketpop .5s ease-out; }
/* the Midland Pacific (train.js): where the train is, near the railroad and aboard */
.train-chip {
  pointer-events: auto; border-radius: 999px; padding: .3em .9em; min-height: 30px; display: inline-flex; align-items: center;
  background: #1d2a44; color: #f2d478; font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow), inset 0 0 0 2px #d9b44a;
}
.train-status { font-weight: 700; color: #1d2a44; background: #f6efe2; border-left: 4px solid #d9b44a; border-radius: 8px; padding: .55em .8em; }
@keyframes ticketpop { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }
.prize-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.prize { display: grid; justify-items: center; gap: 4px; padding: 10px 8px; border: 2px solid var(--line); border-radius: 14px; background: #fff; text-align: center; }
.prize.short { opacity: .7; }
.prize b { font-size: 13px; line-height: 1.2; }
.prize canvas { image-rendering: pixelated; height: 72px; width: auto; }
.prize-cost { font-weight: 900; color: #7a3a9a; }
/* the cinema (cinema.js): the player laid over the screen on the wall, or big over the game view */
#cinema-video { position: fixed; left: 0; top: 0; z-index: 9; transform-origin: 0 0; pointer-events: none; background: #000; overflow: hidden; }
#cinema-video iframe { width: 100%; height: 100%; border: 0; display: block; }
#cinema-video.big { z-index: 16; pointer-events: auto; border-radius: 6px; box-shadow: 0 0 60px rgba(232, 230, 224, .18); }
.cinema-queue { display: grid; gap: 6px; padding-left: 1.4em; }
.cinema-queue span { color: var(--muted); font-size: 13px; }

/* the Mayor's computer: the staff page on a screen */
.monitor { background: #1d2125; border-radius: 14px; padding: 8px; box-shadow: inset 0 0 0 2px #3a3f46; }
.monitor-screen { display: block; width: 100%; height: min(70vh, 720px); border: 0; border-radius: 8px; background: #fff; }

/* a postcard's or a gift's To box: friends, and names as you type (mail.js nameField) */
.name-picks:empty { display: none; }
.name-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.name-label { font-size: 12px; font-weight: 700; color: var(--muted); margin-right: 2px; }

/* how many are in town, under the clock; an admin taps it for the list (main.js whoPanel) */
.online-chip {
  display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; padding: .3em .9em;
  background: rgba(22, 21, 28, .72); color: #fff; font-weight: 700; font-size: 12px; white-space: nowrap; cursor: default;
}
.online-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #2fc87a; box-shadow: 0 0 0 3px rgba(47, 200, 122, .25); }
.online-chip.tappable { cursor: pointer; }
.online-chip.tappable:hover { background: rgba(22, 21, 28, .85); }
.watch-bar { display: inline-flex; align-items: center; gap: 8px; background: #2f3a8a; color: #fff; border-radius: 999px; padding: 3px 3px 3px 12px;
  font-weight: 700; font-size: 13px; box-shadow: var(--shadow); }
.watch-bar .pill { min-height: 28px; padding: .2em .9em; font-size: 13px; }
.who-list { display: grid; gap: 8px; }
.who-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; border: 2px solid var(--line); border-radius: 14px; background: #fff; padding: 8px 10px; }
.who-what { display: grid; min-width: 0; }
.who-what b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-what span { font-size: 13px; color: var(--muted); }
.who-acts { display: flex; gap: 6px; }
