:root {
  --ink: #2b2d42;
  --card: #fffdf5;
  --sun: #ffd166;
  --pink: #ff7eb6;
  --open: #3a86ff;
  --soon: #f4a100;
  --sale: #e63946;
  --font: "Fredoka", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #5ec8ff;
  font-family: var(--font);
  color: var(--ink);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#street {
  position: fixed;
  inset: 0;
  display: block;
  touch-action: none;
  cursor: pointer;
}

/* ---------- HUD ---------- */
.hud {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.hud > * {
  pointer-events: auto;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 5px 14px;
  font-weight: 700;
  box-shadow: 0 4px 0 var(--ink);
  font-size: 15px;
  white-space: nowrap;
}
.hud-home { color: var(--ink); text-decoration: none; }
.hud-home:hover { background: #fff3c4; }
.hud-title { background: var(--sun); }

/* ---------- touch pads (visual hint only, the canvas handles input) ---------- */
.tap-pad {
  position: fixed;
  bottom: max(18px, env(safe-area-inset-bottom));
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: rgba(255, 253, 245, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  pointer-events: none;
}
.tap-left { left: 16px; }
.tap-right { right: 16px; }

/* ---------- hint ---------- */
.hint {
  position: fixed;
  left: 50%;
  top: max(62px, calc(env(safe-area-inset-top) + 52px));
  transform: translateX(-50%);
  background: rgba(43, 45, 66, 0.82);
  color: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.6s;
  max-width: calc(100vw - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
}
.hint.gone { opacity: 0; }
.hint-touch { display: none; }

@media (pointer: coarse) {
  .tap-pad { display: flex; }
  .hint-desktop { display: none; }
  .hint-touch { display: inline; }
}

/* ---------- building prompt ---------- */
.prompt {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(400px, calc(100vw - 32px - 130px));
  min-width: 210px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 10px;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 4px 0 var(--ink);
  padding: 6px 6px 6px 12px;
  text-align: left;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.prompt.hidden,
body.dialog-open .prompt {
  opacity: 0;
  transform: translate(-50%, 20px);
  pointer-events: none;
}
.prompt.at-top {
  bottom: auto;
  top: max(58px, calc(env(safe-area-inset-top) + 50px));
}
.prompt.at-top.hidden,
body.dialog-open .prompt.at-top {
  transform: translate(-50%, -20px);
}
.prompt-name {
  font-size: 17px; font-weight: 700; line-height: 1.15;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.prompt .enter-btn {
  grid-column: 2;
  grid-row: 1 / 3;
  width: auto;
  font-size: 14px;
  padding: 7px 10px;
  line-height: 1.1;
}
.prompt-status {
  justify-self: start;
  white-space: nowrap;
  margin-top: 2px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--open);
  padding: 2px 10px;
  border-radius: 999px;
}
.prompt-status[data-status="coming-soon"] { background: var(--soon); }
.prompt-status[data-status="for-sale"] { background: var(--sale); }
.prompt-status[data-status="portal"] { background: #7c4dff; }

/* ---------- portal transition ---------- */
.fade {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle, #ffffff 0%, #c9b6ff 45%, #6a3fd6 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
body.entering .fade { opacity: 1; transition-delay: 0.75s; }
body.entering .prompt,
body.entering .hint { opacity: 0 !important; pointer-events: none; }

.enter-btn {
  display: block;
  width: 100%;
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
  background: var(--sun);
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 8px 10px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
}
.enter-btn:hover { background: #ffdd85; }
.enter-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.enter-btn:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }

/* ---------- dialog ---------- */
.dialog {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(43, 45, 66, 0.45);
  transition: opacity 0.18s;
}
.dialog.hidden { opacity: 0; pointer-events: none; }
.dialog-card {
  width: min(380px, 100%);
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 22px;
  box-shadow: 0 7px 0 var(--ink);
  padding: 18px 20px 20px;
  text-align: center;
  animation: pop 0.25s ease;
}
.dialog.hidden .dialog-card { animation: none; }
.dialog-icon { font-size: 44px; line-height: 1; }
.dialog-card h2 { margin: 8px 0 6px; font-size: 24px; }
.dialog-chip {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: var(--open);
  padding: 2px 10px;
  border-radius: 999px;
}
.dialog-chip[data-status="coming-soon"] { background: var(--soon); }
.dialog-chip[data-status="for-sale"] { background: var(--sale); }
.dialog-card p { font-size: 16px; line-height: 1.4; margin: 12px 0 16px; }

@keyframes pop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@media (pointer: coarse), (max-width: 560px) {
  /* full-width prompt; at the bottom it sits above the touch pads */
  .prompt { width: calc(100vw - 32px); min-width: 0; }
  .prompt:not(.at-top) { bottom: calc(max(18px, env(safe-area-inset-bottom)) + 66px); }
}

@media (max-width: 420px) {
  .hud > * { font-size: 13px; padding: 4px 10px; }
  .prompt-name { font-size: 15px; }
  .prompt .enter-btn { font-size: 13px; max-width: 130px; }
}

/* ---------- character creator ---------- */
body.creator-open .prompt,
body.creator-open .hint,
body.creator-open .tap-pad { opacity: 0 !important; pointer-events: none; }
.prompt-status[data-status="creator"] { background: #ff5fa2; }

.creator {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(43, 45, 66, 0.45);
  transition: opacity 0.2s;
}
.creator.hidden { opacity: 0; pointer-events: none; }
.creator-card {
  width: min(860px, 100%);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 24px;
  box-shadow: 0 7px 0 var(--ink);
  overflow: hidden;
  animation: pop 0.25s ease;
}
.creator-head { padding: 14px 20px 8px; text-align: center; }
.creator-kicker {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: #ff5fa2;
  border-radius: 999px;
  padding: 2px 12px;
}
.creator-head h2 { margin: 6px 0 0; font-size: 26px; }
.creator-body {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 1.25fr;
  gap: 16px;
  padding: 8px 20px 12px;
  min-height: 0;
  flex: 1;
}
.creator-preview {
  position: relative;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: radial-gradient(circle at 50% 35%, #ffffff 0%, #e6dcff 55%, #c9b6ff 100%);
  min-height: 300px;
  overflow: hidden;
}
.creator-preview canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.creator-controls { overflow-y: auto; padding-right: 4px; }
.creator-controls section + section { margin-top: 14px; }
.creator-controls h3 { margin: 0 0 8px; font-size: 16px; }

.creator-shapes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.shape-btn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 6px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
}
.shape-icon { font-size: 24px; line-height: 1; }
.shape-btn[aria-pressed="true"] { background: var(--sun); }
.shape-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

.creator-swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.swatch {
  aspect-ratio: 1;
  min-height: 34px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: var(--swatch);
  cursor: pointer;
  position: relative;
}
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--card), 0 0 0 6px var(--ink); }
.swatch[aria-pressed="true"]::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 3px var(--ink), 0 0 2px var(--ink);
}

.creator-toggles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 12px; }
.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
}
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  flex: none;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  border: 3px solid var(--ink);
  background: #d9d4cc;
  position: relative;
  transition: background 0.15s;
}
.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--ink);
  transition: transform 0.15s;
}
.switch input:checked + .switch-track { background: #4cc96b; }
.switch input:checked + .switch-track .switch-knob { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--pink); outline-offset: 2px; }

.soon-tag {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: #9a8fb5;
  border-radius: 999px;
  padding: 1px 8px;
  vertical-align: middle;
}
.creator-extra-row { display: flex; gap: 8px; flex-wrap: wrap; }
.extra-tile {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 3px dashed #b9b2a6;
  border-radius: 14px;
  padding: 6px 12px;
  color: #8a8478;
  font-weight: 600;
}
.extra-icon { font-size: 20px; filter: grayscale(0.6); }

.creator-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px 16px;
  border-top: 3px solid #eee7da;
}
.creator-foot .enter-btn { width: auto; padding: 10px 28px; }
.creator-cancel {
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 8px 18px;
  cursor: pointer;
}
.creator-cancel[hidden] { display: none; }
.shape-btn:focus-visible, .swatch:focus-visible, .creator-cancel:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }

@media (max-width: 640px) {
  .creator { padding: 8px; }
  .creator-card { max-height: calc(100dvh - 16px); border-radius: 20px; }
  .creator-head { padding: 10px 14px 4px; }
  .creator-head h2 { font-size: 21px; }
  .creator-body { grid-template-columns: 1fr; padding: 6px 14px 8px; overflow-y: auto; gap: 10px; }
  .creator-preview { min-height: 200px; height: 30dvh; }
  .creator-controls { overflow: visible; }
  .shape-btn { font-size: 11px; }
  .shape-icon { font-size: 20px; }
  .creator-foot { padding: 10px 14px 12px; }
  .creator-foot .enter-btn { flex: 1; }
}

/* ---------- accounts ---------- */
body.account-open .prompt,
body.account-open .hint,
body.account-open .tap-pad { opacity: 0 !important; pointer-events: none; }

.account {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(43, 45, 66, 0.5);
  transition: opacity 0.2s;
}
.account.hidden { opacity: 0; pointer-events: none; }
.account-card {
  position: relative;
  width: min(400px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 22px;
  box-shadow: 0 7px 0 var(--ink);
  padding: 20px 22px 18px;
  text-align: center;
  animation: pop 0.25s ease;
}
.account-card h2 { margin: 6px 0 4px; font-size: 26px; }
.account-kicker {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: #3a86ff;
  border-radius: 999px;
  padding: 2px 12px;
}
.account-sub { margin: 4px 0 14px; font-size: 15px; line-height: 1.35; }
.account-fine, .account-note { margin: 12px 0 0; font-size: 13px; line-height: 1.4; color: #5c5f77; }
.account-note { background: #fff4d6; border: 2px solid #f0d58a; border-radius: 12px; padding: 8px 10px; color: var(--ink); }
.account-actions { display: grid; gap: 10px; margin-top: 14px; }
.account-btn {
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 8px 10px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
}
.account-btn:hover { background: #f3efe6; }
.account-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.account-card button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.account-x {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.account-x[hidden] { display: none; }
.account-form { display: grid; gap: 10px; text-align: left; margin-top: 6px; }
.account-form label { display: grid; gap: 4px; font-weight: 700; font-size: 14px; }
.account-form input {
  font: inherit;
  font-size: 17px;
  padding: 9px 12px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  min-width: 0;
}
.account-form input:focus-visible { outline: 3px solid var(--pink); outline-offset: 1px; }
.account-error { min-height: 1.2em; margin: 0; color: #c1121f; font-weight: 600; font-size: 14px; }
.account-link {
  margin-top: 12px;
  font: inherit;
  font-weight: 600;
  color: #3a86ff;
  background: none;
  border: 0;
  cursor: pointer;
}
.account-wallets {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.account-wallets li {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 2px solid #e4ddd0;
  border-radius: 12px;
  padding: 6px 12px;
  font-weight: 600;
}
.account-wallets b { margin-left: auto; font-size: 18px; }

/* account button: long usernames get "…" */
#accountBtn { max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 480px) {
  .hud-label { display: none; }   /* home + camera buttons become icon-only */
  #accountBtn { max-width: 150px; }
}

/* ---------- Town Hall (townhall.js) ---------- */
.prompt-status[data-status="townhall"] { background: #e85d75; }
body.townhall-open .prompt,
body.townhall-open .hint,
body.townhall-open .tip,
body.townhall-open .tap-pad,
body.account-open .tip,
body.creator-open .tip { opacity: 0 !important; pointer-events: none; }

.townhall {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(43, 45, 66, 0.5);
  transition: opacity 0.2s;
}
.townhall.hidden { opacity: 0; pointer-events: none; }
.townhall-card {
  position: relative;
  width: min(640px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 22px;
  box-shadow: 0 7px 0 var(--ink);
  padding: 20px 22px 18px;
  animation: pop 0.25s ease;
}
.townhall-head { text-align: center; padding: 0 30px; }
.townhall-kicker { background: #e85d75; }
.townhall-head h2 { margin: 6px 0 4px; font-size: 28px; }
.townhall-head p { margin: 0; font-size: 16px; line-height: 1.4; }
.townhall-section { margin-top: 16px; }
.townhall-section h3 { margin: 0 0 8px; font-size: 18px; }
.townhall-section ul { list-style: none; margin: 0; padding: 0; }

.townhall-how { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.townhall-how li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #fff;
  border: 2px solid #e4ddd0;
  border-radius: 14px;
  padding: 8px 10px;
}
.townhall-icon { font-size: 26px; line-height: 1.1; }
.townhall-how b { font-size: 15px; }
.townhall-how p { margin: 2px 0 0; font-size: 14px; line-height: 1.35; color: #4a4d66; }

.townhall-board {
  background: #6b4f3a;
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 10px 12px 12px;
  color: #fff;
}
.townhall-board h3 { color: #fff; text-align: center; }
.townhall-board ul { display: grid; gap: 6px; }
.townhall-board li {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fffdf5;
  color: var(--ink);
  border-radius: 10px;
  padding: 6px 8px 6px 12px;
  font-weight: 700;
}
.townhall-board li > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.townhall-chip {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 13px;
  color: #fff;
  border-radius: 999px;
  padding: 2px 10px;
}
.townhall-chip.is-open { background: #7c4dff; }
.townhall-chip.is-soon { background: var(--soon); }

.townhall-controls { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.townhall-controls h4 { margin: 0 0 6px; font-size: 15px; }
.townhall-controls li { display: flex; gap: 8px; align-items: baseline; font-size: 14px; padding: 3px 0; }
.townhall-controls kbd {
  flex-shrink: 0;
  font: inherit;
  font-weight: 700;
  font-size: 12px;
  white-space: pre;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 8px;
  box-shadow: 0 2px 0 var(--ink);
  padding: 1px 7px;
}
.townhall-done { display: block; width: auto; margin: 18px auto 0; padding: 10px 28px; }

@media (max-width: 560px) {
  .townhall-card { padding: 16px 14px 14px; }
  .townhall-head { padding: 0 26px; }
  .townhall-head h2 { font-size: 23px; }
  .townhall-how, .townhall-controls { grid-template-columns: 1fr; }
}

/* one-time tip pointing new players to the Town Hall */
.tip {
  position: fixed;
  left: 0;
  right: 0;
  margin: 0 auto;
  top: max(124px, calc(env(safe-area-inset-top) + 116px));
  z-index: 12;   /* centred with margin, so the pop animation can use transform */
  width: min(440px, calc(100vw - 32px));
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffe3f0;
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 4px 0 var(--ink);
  padding: 8px 8px 8px 14px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  animation: pop 0.3s ease;
  transition: opacity 0.2s;
}
.tip.hidden { display: none; }
.tip .enter-btn { width: auto; flex-shrink: 0; padding: 6px 14px; font-size: 14px; }

/* ---------- portal keeper's room (inside a game building) ---------- */
body.in-room .prompt,
body.in-room .hint,
body.in-room .tip,
body.in-room .tap-pad { opacity: 0 !important; pointer-events: none; }

/* quick flash while jumping between the street and a room */
body.switching .fade { opacity: 1; transition: opacity 0.22s ease; transition-delay: 0s; }
body.switching .fade-swirl,
body.switching .fade-text { opacity: 0; }

.keeper {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(16px, env(safe-area-inset-bottom));
  margin: 0 auto;
  width: min(460px, calc(100vw - 32px));
  z-index: 12;
  transition: opacity 0.2s, transform 0.2s;
}
.keeper.hidden { opacity: 0; transform: translateY(20px); pointer-events: none; }
.keeper-card {
  position: relative;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 6px 0 var(--ink);
  padding: 14px 16px 12px;
}
/* little speech-bubble tail pointing up at the keeper */
.keeper-card::before {
  content: "";
  position: absolute;
  top: -15px;
  left: 30%;
  width: 22px;
  height: 22px;
  background: var(--card);
  border-left: 3px solid var(--ink);
  border-top: 3px solid var(--ink);
  transform: rotate(45deg);
  border-radius: 4px 0 0 0;
}
.keeper-name {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: #7c4dff;
  border-radius: 999px;
  padding: 2px 12px;
}
.keeper-line { margin: 8px 0 4px; font-size: 18px; font-weight: 700; line-height: 1.3; }
.keeper-note { margin: 0 0 12px; font-size: 14px; line-height: 1.4; color: #4a4d66; }
.keeper-actions { display: flex; gap: 10px; }
.keeper-actions .account-btn { flex: 0 0 auto; font-size: 14px; }
.keeper-actions .enter-btn { flex: 1; width: auto; background: #b69cff; }
.keeper-actions .enter-btn:hover { background: #c7b3ff; }
.keeper-keys { margin-top: 8px; font-size: 12px; color: #6b6e86; text-align: center; }
@media (pointer: coarse) { .keeper-keys { display: none; } }
@media (max-width: 420px) {
  .keeper-line { font-size: 16px; }
  .keeper-actions { flex-direction: column-reverse; }
}

/* transfer animation: a spinning swirl and "Floating to …" */
.fade { display: flex; align-items: center; justify-content: center; z-index: 40; }
.fade-swirl {
  position: absolute;
  width: 160vmax;
  height: 160vmax;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.35) 0 12deg, rgba(255, 255, 255, 0) 12deg 30deg);
  opacity: 0.8;
}
body.entering .fade-swirl { animation: swirl 1.6s linear infinite; }
@keyframes swirl { to { transform: rotate(360deg); } }
.fade-text {
  position: relative;
  font-size: clamp(22px, 5vw, 34px);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 3px 0 #3a1d8f, 0 0 18px rgba(58, 29, 143, 0.6);
  text-align: center;
  padding: 0 16px;
}
body.entering .fade-text { animation: pop 0.4s ease 0.8s both; }

/* ---------- Ingwell Bank (bank.js) — reuses the Town Hall panel ---------- */
.prompt-status[data-status="bank"] { background: #2e9e6a; }
.bank-kicker { background: #2e9e6a; }
.bank-counter { margin: 10px auto 0; width: min(320px, 100%); }
.bank-glass {
  height: 74px;
  border: 3px solid var(--ink);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(135deg, #e3f6ff 0%, #c9ecff 60%, #e3f6ff 100%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}
.bank-teller { font-size: 58px; line-height: 1; transform: translateY(8px); }
.bank-desk { height: 18px; background: #2e9e6a; border: 3px solid var(--ink); border-radius: 6px; box-shadow: 0 3px 0 var(--ink); }
.bank-greeting { text-align: center; margin: 10px 0 0; font-size: 15px; }

.bank-wallets { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.bank-wallets li {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 2px solid #e4ddd0; border-radius: 14px; padding: 8px 12px;
}
.bank-icon { font-size: 26px; }
.bank-wname { display: grid; font-weight: 700; font-size: 15px; line-height: 1.2; }
.bank-wname small { font-weight: 500; font-size: 12px; color: #6b6e86; }
.bank-wallets b { margin-left: auto; font-size: 22px; }

.bank-exchange { background: #effaf2; border: 2px solid #bfe5cb; border-radius: 16px; padding: 10px 12px 12px; }
.bank-form { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: end; }
.bank-form label { display: grid; gap: 4px; font-weight: 700; font-size: 14px; min-width: 0; }
.bank-form select, .bank-form input {
  font: inherit; font-size: 16px; color: var(--ink); background: #fff;
  border: 3px solid var(--ink); border-radius: 12px; padding: 7px 10px; min-width: 0; width: 100%;
}
.bank-form select:focus-visible, .bank-form input:focus-visible, .bank-swap:focus-visible { outline: 3px solid var(--pink); outline-offset: 1px; }
.bank-swap {
  font: inherit; font-size: 20px; font-weight: 700; width: 44px; height: 44px;
  border: 3px solid var(--ink); border-radius: 50%; background: var(--sun); cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
}
.bank-amount { grid-column: 1 / -1; }
.bank-amount > span { display: flex; gap: 8px; }
.bank-amount .account-btn { flex-shrink: 0; }
.bank-preview { min-height: 46px; margin: 10px 0 8px; font-size: 15px; line-height: 1.4; }
.bank-swapline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #fff; border-radius: 12px; padding: 8px 12px; border: 2px solid #bfe5cb; }
.bank-arrow { font-size: 20px; font-weight: 700; color: #2e9e6a; }
.bank-hint { color: #5c5f77; font-size: 14px; margin-top: 4px; }
.bank-bad { color: #c1121f; font-weight: 600; margin-top: 4px; }
.bank-confirm { width: 100%; background: #7fdc9b; }
.bank-confirm:hover { background: #96e6ad; }
.bank-confirm:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.bank-done { margin: 8px 0 0; min-height: 1em; font-weight: 700; color: #1f7a4d; text-align: center; }
.bank-done:empty { display: none; }

.bank-rates li { padding: 2px 0; font-weight: 600; }
.bank-history { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.bank-history li { display: flex; justify-content: space-between; gap: 10px; background: #fff; border: 2px solid #e4ddd0; border-radius: 10px; padding: 5px 10px; font-weight: 600; }
.bank-history small { color: #6b6e86; font-weight: 500; white-space: nowrap; }
.bank-none { color: #6b6e86; margin: 0; }
@media (max-width: 420px) {
  .bank-form { grid-template-columns: 1fr; }
  .bank-swap { justify-self: center; transform: rotate(90deg); }
}

/* ---------- Float Factory shop (creator.js, factory mode) ---------- */
.creator-extras h3 { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.shop-wallet { font-size: 13px; font-weight: 600; color: #5c5f77; }
.shop-row + .shop-row { margin-top: 10px; }
.shop-row-label { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.shop-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
.shop-item {
  display: grid;
  justify-items: center;
  gap: 2px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 6px 4px 5px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
  text-align: center;
}
.shop-item:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.shop-item[aria-pressed="true"] { background: var(--sun); }
.shop-item:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
.shop-icon { font-size: 22px; line-height: 1.1; }
.shop-tag { font-size: 11px; font-weight: 700; background: #eef0ff; color: #3d3f99; border-radius: 999px; padding: 1px 7px; }
.shop-tag.owned { background: #dff7e7; color: #1f7a4d; }
.shop-bar:empty { display: none; }
.shop-bar { margin-top: 10px; display: grid; gap: 8px; }
.shop-try {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 10px;
  flex-wrap: wrap;
  background: #fff4d6;
  border: 2px solid #f0d58a;
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 14px;
}
.shop-buy { width: auto; padding: 6px 16px; font-size: 14px; background: #7fdc9b; }
.shop-buy:hover { background: #96e6ad; }
.shop-short { font-size: 13px; font-weight: 600; color: #c1121f; }
.shop-note { margin: 0; font-size: 12px; color: #6b6e86; }
.shop-msg { margin: 0; font-weight: 700; color: #1f7a4d; }
