/* The lobby (lobby.html): smoked-glass panels over the campfire at dusk. Pink picks things, gold is for titles and
   the fire, mint for what's live. Type steps: 11, 12, 13, 15, 20, 28, 40. */
:root {
  --ink: #2a2342;
  --night: #120c26;
  --text: #fff;
  --text-2: rgba(255, 255, 255, 0.74);
  --text-3: rgba(255, 255, 255, 0.5);
  --line: rgba(255, 255, 255, 0.12);
  --surface: rgba(255, 255, 255, 0.06);
  --sakura: #ff7fae;
  --sakura-deep: #e8558f;
  --gold: #ffd46b;
  --mint: #7fe8b8;
  --glass: linear-gradient(180deg, rgba(34, 24, 66, 0.72), rgba(20, 14, 42, 0.78));
  --font: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', system-ui, sans-serif;
  --display: 'Dela Gothic One', var(--font);
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--night);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
[hidden] {
  display: none !important;
}

#stage canvas {
  display: block;
  position: fixed;
  inset: 0;
  touch-action: none;
}
#veil {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--night);
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.9s;
}
body.ready #veil {
  opacity: 0;
}
body.leaving #veil {
  opacity: 1;
  transition-duration: 0.45s;
}

.glass {
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 22px;
  box-shadow:
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.14),
    inset 0 1px 1px rgba(255, 255, 255, 0.2),
    0 18px 50px -14px rgba(0, 0, 0, 0.6);
}

/* ---------- title and corner buttons ---------- */

#brand {
  position: fixed;
  top: 18px;
  left: 22px;
  z-index: 5;
  pointer-events: none;
  text-shadow: 0 2px 12px rgba(20, 10, 40, 0.6);
}
#brand h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #ffc2d8;
  text-shadow:
    2px 2px 0 var(--sakura-deep),
    0 4px 18px rgba(255, 127, 174, 0.45);
}
#brand p {
  margin: 6px 0 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.42em;
  color: var(--text-2);
}
#brand p span {
  color: #a9b8ff;
}
/* The build, at the end of the name's line (a line of its own would run into the sound button): quiet, in a pill. */
#brand p small {
  margin-left: 0.3em;
  padding: 1px 7px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-3);
  vertical-align: 1px;
}
#brand p small:empty {
  display: none;
}
/* A newer build is running (lobby.js behind): in the version's place, a pink button that reloads for it, old → new. */
#brand p button {
  margin-left: 0.3em;
  padding: 3px 11px 4px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff7fae, #d9447f);
  box-shadow:
    0 2px 0 #b8336a,
    0 4px 14px -2px rgba(255, 127, 174, 0.7);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #fff;
  white-space: nowrap;
  text-shadow: none;
  vertical-align: 1px;
  pointer-events: auto; /* (the name round it lets clicks through to the fire) */
  animation: update-pop 0.45s cubic-bezier(0.3, 1.6, 0.5, 1);
}
#brand p button:hover {
  filter: brightness(1.08);
}
#brand p button span {
  color: inherit; /* (not the name's blue) */
  opacity: 0.8;
}
#brand p button b {
  font-weight: 900;
}
#brand p button i {
  font-style: normal;
}
@keyframes update-pop {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  #brand p button {
    animation: none;
  }
}
.icon-btn {
  position: fixed;
  top: 84px;
  left: 22px;
  z-index: 6;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: rgba(20, 14, 42, 0.55);
  box-shadow: inset 0 0 0 1.5px var(--line);
  font-size: 18px;
}
.icon-btn:hover {
  background: rgba(40, 28, 80, 0.7);
}
#fame-btn {
  top: 134px;
  transition: opacity 0.25s;
}
body[data-screen='create'] #fame-btn,
body[data-screen='fame'] #fame-btn {
  opacity: 0;
  pointer-events: none;
}

#invite {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  margin: 0;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255, 127, 174, 0.92);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 8px 24px -8px rgba(232, 85, 143, 0.8);
}

/* ---------- screens: one at a time, sliding in ---------- */

.screen {
  transition:
    opacity 0.35s,
    transform 0.35s,
    visibility 0s;
}
body:not([data-screen='select']) #select,
body:not([data-screen='create']) #create,
body:not([data-screen='towns']) #towns,
body:not([data-screen='fame']) #fame {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.25s,
    transform 0.25s,
    visibility 0s 0.25s;
}

/* ---------- 1. character select ---------- */

#roster {
  position: fixed;
  z-index: 4;
  top: 50%;
  right: 22px;
  width: 290px;
  max-height: calc(100vh - 140px);
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  padding: 16px 14px 14px;
}
body:not([data-screen='select']) #roster {
  transform: translateY(-50%) translateX(30px);
}
#roster h2 {
  margin: 0 6px 10px;
  font: 400 15px var(--display);
  letter-spacing: 0.04em;
}
#roster h2 small {
  font: 700 12px var(--font);
  color: var(--text-3);
  margin-left: 4px;
}
#heroes {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}
.hero-card {
  width: 100%;
  display: grid;
  grid-template-columns: 40px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: none;
  border-radius: 14px;
  background: var(--surface);
  text-align: left;
  transition:
    background 0.15s,
    box-shadow 0.15s;
}
.hero-card:hover {
  background: rgba(255, 255, 255, 0.1);
}
.hero-card.on {
  background: linear-gradient(135deg, rgba(255, 127, 174, 0.34), rgba(255, 127, 174, 0.14));
  box-shadow: inset 0 0 0 2px var(--sakura);
}
.hero-card .face {
  grid-row: span 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 17px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  box-shadow:
    inset 0 -4px 0 rgba(0, 0, 0, 0.15),
    0 0 0 2px rgba(255, 255, 255, 0.8);
}
.hero-card b {
  font-size: 15px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hero-card small {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hero-card small.when {
  grid-column: 2;
  color: var(--text-3);
  font-size: 11px;
}
.add {
  margin-top: 8px;
  padding: 11px;
  border-radius: 14px;
  border: 2px dashed rgba(255, 255, 255, 0.28);
  background: none;
  font-weight: 800;
  font-size: 14px;
  color: var(--text-2);
}
.add:hover {
  border-color: var(--sakura);
  color: #fff;
}

#sheet {
  position: fixed;
  z-index: 4;
  left: calc((100vw - 290px - 22px) / 2);
  bottom: 22px;
  transform: translateX(-50%);
  width: min(460px, calc(100vw - 290px - 66px));
  padding: 16px 20px 14px;
  text-align: center;
}
body:not([data-screen='select']) #sheet {
  transform: translateX(-50%) translateY(30px);
}
#sheet h3 {
  margin: 0;
  font: 400 28px var(--display);
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.title {
  display: inline-block;
  margin: 6px 0 0;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(255, 212, 107, 0.16);
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
}
.stats {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  margin: 12px 0 0;
  padding: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
}
.stats b {
  color: #fff;
  font-weight: 900;
}
.next {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
}
.next:empty {
  display: none;
}
.played-when {
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
}
.played-when:empty {
  display: none;
}
.sheet-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
}
.round {
  flex: none;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--line);
  font-size: 17px;
}
.round:hover {
  background: rgba(255, 255, 255, 0.14);
}
.playing {
  margin: 10px 0 0;
  font-size: 12px;
  font-weight: 800;
  color: var(--mint);
}
.playing:empty {
  display: none;
}

.primary {
  border: none;
  border-radius: 16px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #ff9cc0, var(--sakura-deep));
  color: #fff;
  font-weight: 900;
  font-size: 15px;
  box-shadow: 0 5px 0 #b8386c;
  transition:
    transform 0.1s,
    box-shadow 0.1s,
    filter 0.15s;
}
.primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}
.primary:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #b8386c;
}
.primary:disabled {
  filter: grayscale(0.8) brightness(0.7);
  transform: none;
  cursor: default;
}
.primary.big {
  min-width: 180px;
  padding: 14px 28px;
  font-size: 18px;
}
.ghost {
  border: none;
  border-radius: 14px;
  padding: 11px 16px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--line);
  font-weight: 800;
  font-size: 14px;
}
.ghost:hover {
  background: rgba(255, 255, 255, 0.12);
}
.ghost.small {
  padding: 8px 14px;
  font-size: 13px;
}
.danger {
  border: none;
  border-radius: 14px;
  padding: 11px 16px;
  background: #e8475f;
  color: #fff;
  font-weight: 900;
  font-size: 14px;
}

/* ---------- 2. character creator ---------- */

#create {
  position: fixed;
  z-index: 4;
  top: 50%;
  right: 22px;
  width: 400px;
  max-height: calc(100vh - 44px);
  transform: translateY(-50%);
  overflow-y: auto;
  padding: 20px 22px 0;
  scrollbar-width: thin;
}
body:not([data-screen='create']) #create {
  transform: translateY(-50%) translateX(40px);
}
#create h2 {
  flex: 1;
  margin: 0;
  font: 400 20px var(--display);
}
.create-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
#surprise {
  flex: none;
  white-space: nowrap;
}
#create .sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-2);
}
#create .sub:empty {
  display: none;
}
.field {
  display: block;
  margin: 14px 0;
}
.field > span:first-child {
  display: block;
  margin-bottom: 7px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}
.field > span small {
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}
/* A row's own label inside a field (an outfit's accent and pattern, each place for an accessory). */
.field > span.sub {
  display: block;
  margin: 10px 0 5px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}
/* Accents: smaller than the outfit's own colours, so the two rows read apart. */
.swatches.accent .swatch {
  width: 22px;
  height: 22px;
  border-width: 2px;
}
.name-row {
  display: flex;
  gap: 8px;
}
#name {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  border-radius: 14px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 2px var(--line);
  font-size: 17px;
  font-weight: 800;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}
#name:focus {
  box-shadow: inset 0 0 0 2px var(--sakura);
}
#name.shake {
  animation: shake 0.4s;
}
@keyframes shake {
  25% {
    transform: translateX(-6px);
  }
  50% {
    transform: translateX(6px);
  }
  75% {
    transform: translateX(-3px);
  }
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 9px;
}
.chips button {
  padding: 6px 12px;
  border: none;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--line);
  font-size: 13px;
  font-weight: 700;
  transition: background 0.15s;
}
.chips button:hover {
  background: rgba(255, 255, 255, 0.12);
}
.chips button.on {
  background: var(--sakura);
  box-shadow: none;
  color: #fff;
}
.chips button.locked {
  color: var(--text-3);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.1);
  background: none;
}
.chips button.locked::before {
  content: '🔒 ';
}
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.swatch {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.9);
  transition: transform 0.15s;
}
.swatch:hover {
  transform: scale(1.12);
}
.swatch.on {
  box-shadow: 0 0 0 3px var(--sakura);
  transform: scale(1.15);
}
.voice-pick {
  display: flex;
  gap: 8px;
}
#opt-voice {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 14px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1.5px var(--line);
  font-size: 14px;
  font-weight: 700;
  outline: none;
}
#opt-voice option,
#opt-voice optgroup {
  background: #231a45;
  color: #fff;
}
#voice-hear:disabled {
  opacity: 0.4;
}
.actions {
  display: flex;
  gap: 8px;
  margin: 18px -22px 0;
  padding: 14px 22px 18px;
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgba(22, 15, 46, 0), rgba(22, 15, 46, 0.96) 30%);
}
.actions button {
  flex: 1;
  padding: 12px 8px;
}
.actions .primary {
  flex: 1.3;
}

/* ---------- 3. towns ---------- */

#towns {
  position: fixed;
  z-index: 4;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  width: min(720px, calc(100vw - 44px));
  max-height: calc(100vh - 44px);
  overflow-y: auto;
  scrollbar-width: none;
}
body:not([data-screen='towns']) #towns {
  transform: translateY(-50%) translateX(40px);
}
.towns-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.towns-head .ghost {
  background: rgba(20, 14, 42, 0.72);
}
.towns-head h2 {
  flex: 1;
  margin: 0;
  font: 400 24px var(--display);
  text-shadow: 0 2px 12px rgba(20, 10, 40, 0.7);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* The list: one row a town, like a server browser. */
#server-list {
  padding: 6px 8px 8px;
}
.list-head,
.server {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) 70px 150px 86px 72px;
  align-items: center;
  column-gap: 12px;
}
.list-head {
  padding: 8px 10px 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}
.server {
  padding: 8px 10px;
  border-radius: 16px;
  cursor: pointer;
  outline: none;
  transition: background 0.15s;
}
.server + .server {
  margin-top: 4px;
}
.server:hover {
  background: rgba(255, 255, 255, 0.06);
}
.server.on {
  background: linear-gradient(135deg, rgba(255, 127, 174, 0.3), rgba(255, 127, 174, 0.1));
  box-shadow: inset 0 0 0 2px var(--sakura);
}
.server:focus-visible {
  box-shadow: inset 0 0 0 2px var(--gold);
}
.thumb {
  aspect-ratio: 320 / 130;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.2);
}
.thumb svg {
  display: block;
  width: 100%;
  height: 100%;
}
.server .name {
  min-width: 0;
}
.server .name b {
  display: block;
  font: 400 17px var(--display);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.server .name small {
  font: 800 11px var(--font);
  color: var(--text-3);
  margin-left: 3px;
}
.server .sub {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.server .sub.who {
  color: var(--text-2);
}
.server .players {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 16px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.server .players i {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-3);
}
.server.full .players i {
  background: var(--mint);
  animation: pulse 1.8s infinite;
}
.server.down .players i {
  background: #ff9a7a;
}
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(127, 232, 184, 0.7);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(127, 232, 184, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(127, 232, 184, 0);
  }
}
.server .night {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ping {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}
.bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}
.bars i {
  width: 4px;
  border-radius: 1.5px;
  background: rgba(255, 255, 255, 0.16);
}
.bars i:nth-child(1) {
  height: 5px;
}
.bars i:nth-child(2) {
  height: 8px;
}
.bars i:nth-child(3) {
  height: 11px;
}
.bars i:nth-child(4) {
  height: 14px;
}
.ping.good .bars i.lit {
  background: var(--mint);
}
.ping.ok .bars i.lit {
  background: var(--gold);
}
.ping.bad .bars i.lit {
  background: #ff8a7a;
}
.server .join {
  padding: 9px 10px;
  font-size: 14px;
}
.list-foot {
  margin: 10px 6px 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  text-align: right;
  text-shadow: 0 1px 8px rgba(20, 10, 40, 0.8);
}

/* ---------- 4. the hall of fame ---------- */

#fame {
  position: fixed;
  z-index: 4;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  width: min(460px, calc(100vw - 44px));
  max-height: calc(100vh - 44px);
  overflow-y: auto;
  padding: 18px 20px 20px;
  scrollbar-width: thin;
}
body:not([data-screen='fame']) #fame {
  transform: translateY(-50%) translateX(40px);
}
.fame-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.fame-head h2 {
  margin: 0;
  font: 400 22px var(--display);
}
#fame .sub {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-2);
}
#fame .empty {
  margin: 18px 0 4px;
  font-size: 14px;
  font-weight: 800;
  color: var(--gold);
}
#fame h3 {
  margin: 18px 0 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}
#fame h4 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 800;
}
.fame-towns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.fame-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fame-list li {
  display: grid;
  grid-template-columns: 30px 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 12px;
  background: var(--surface);
}
.fame-list li.mine {
  background: linear-gradient(135deg, rgba(255, 127, 174, 0.32), rgba(255, 127, 174, 0.12));
  box-shadow: inset 0 0 0 1.5px var(--sakura);
}
.fame-list li.none {
  display: block;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 700;
}
.fame-list .rank {
  font-size: 15px;
  font-weight: 900;
  text-align: center;
}
.fame-list .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.8);
}
.fame-list .who {
  min-width: 0;
}
.fame-list .who b {
  display: block;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fame-list .who small {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fame-list .score {
  font-size: 14px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #ffb3cf;
}
.fame-towns .fame-list li {
  grid-template-columns: 24px minmax(0, 1fr) auto;
}
.fame-towns .fame-list .dot {
  display: none;
}

/* ---------- the delete dialog, hover tip, hint and toast ---------- */

#confirm {
  border: none;
  border-radius: 24px;
  padding: 22px 24px 18px;
  width: min(360px, calc(100vw - 32px));
  background: #211845;
  color: #fff;
  text-align: center;
  box-shadow:
    inset 0 0 0 1.5px var(--line),
    0 30px 80px rgba(0, 0, 0, 0.6);
}
#confirm::backdrop {
  background: rgba(10, 6, 24, 0.6);
  backdrop-filter: blur(3px);
}
#confirm .big {
  margin: 0;
  font-size: 36px;
}
#confirm h3 {
  margin: 6px 0 0;
  font: 400 19px var(--display);
}
#confirm .sub {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-2);
}
#confirm .actions {
  position: static;
  margin: 18px 0 0;
  padding: 0;
  background: none;
}

#tip {
  position: fixed;
  z-index: 8;
  pointer-events: none;
  padding: 6px 12px;
  border-radius: 12px;
  background: rgba(20, 14, 42, 0.85);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 14px));
  opacity: 0;
  transition: opacity 0.12s;
}
#tip.on {
  opacity: 1;
}
#tip small {
  display: block;
  color: var(--gold);
  font-size: 11px;
}

#spin-hint {
  position: fixed;
  z-index: 3;
  margin: 0;
  bottom: 26px;
  left: calc((100vw - 422px) / 2);
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 800;
  color: var(--text-3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}
body[data-screen='create']:not(.spun) #spin-hint {
  opacity: 1;
}

#toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 20px);
  padding: 10px 18px;
  border-radius: 14px;
  background: rgba(20, 14, 42, 0.92);
  box-shadow: inset 0 0 0 1.5px var(--line);
  font-size: 14px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
}
#toast.on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- narrower screens: panels dock along the bottom, the roster runs along the top ---------- */

@media (max-width: 980px) {
  #towns {
    top: auto;
    bottom: 16px;
    right: 50%;
    transform: translateX(50%);
    max-height: 62vh;
  }
  body:not([data-screen='towns']) #towns {
    transform: translateX(50%) translateY(40px);
  }
}

@media (max-width: 760px) {
  #brand {
    top: 12px;
    left: 14px;
  }
  #brand h1 {
    font-size: 26px;
  }
  #brand p {
    font-size: 9px;
    letter-spacing: 0.3em;
  }
  /* (No room at the end of the name's line here: up beside 桜町 instead, just the versions and the ↻.) */
  #brand p button {
    position: absolute;
    top: 3px;
    left: 66px;
    margin: 0;
    font-size: 10px;
  }
  #brand p button i {
    display: none;
  }
  .icon-btn {
    top: 12px;
    left: auto;
    right: 12px;
    width: 36px;
    height: 36px;
    font-size: 15px;
  }
  #invite {
    top: auto;
    bottom: calc(100% - 118px);
    font-size: 12px;
  }
  #roster {
    top: 66px;
    left: 12px;
    right: 12px;
    width: auto;
    max-height: none;
    transform: none;
    padding: 10px;
    flex-direction: row;
    align-items: stretch;
    gap: 8px;
  }
  body:not([data-screen='select']) #roster {
    transform: translateY(-20px);
  }
  #roster h2 {
    display: none;
  }
  #heroes {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    flex: 1;
  }
  #heroes li {
    flex: none;
  }
  .hero-card small.when {
    display: none;
  }
  #fame-btn {
    top: 12px;
    right: 56px;
  }
  #fame {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    max-height: 60vh;
    transform: none;
    border-radius: 22px 22px 0 0;
    padding: 16px;
  }
  body:not([data-screen='fame']) #fame {
    transform: translateY(40px);
  }
  #fame-back span {
    display: none;
  }
  .hero-card {
    width: auto;
    grid-template-columns: 34px auto;
    padding: 6px 12px 6px 6px;
  }
  .hero-card .face {
    width: 34px;
    height: 34px;
    font-size: 15px;
  }
  .hero-card b {
    font-size: 13px;
    max-width: 110px;
  }
  .hero-card small {
    font-size: 11px;
    max-width: 110px;
  }
  .add {
    margin: 0;
    flex: none;
    padding: 6px 12px;
    font-size: 13px;
  }
  #sheet {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    transform: none;
    padding: 12px 14px;
  }
  body:not([data-screen='select']) #sheet {
    transform: translateY(30px);
  }
  #sheet h3 {
    font-size: 22px;
  }
  .stats {
    font-size: 12px;
    gap: 4px 10px;
    margin-top: 8px;
  }
  .primary.big {
    min-width: 0;
    flex: 1;
    font-size: 17px;
    padding: 13px 18px;
  }
  #create {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    max-height: 56vh;
    transform: none;
    border-radius: 22px 22px 0 0;
    padding: 16px 16px 0;
  }
  body:not([data-screen='create']) #create {
    transform: translateY(40px);
  }
  .actions {
    margin: 14px -16px 0;
    padding: 12px 16px 16px;
  }

  #spin-hint {
    left: 50%;
    bottom: calc(56vh + 10px);
  }
  #towns {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    transform: none;
    max-height: 72vh;
  }
  body:not([data-screen='towns']) #towns {
    transform: translateY(40px);
  }
  /* A row: the picture, then the name over players and night, ping over the button. */
  .list-head,
  .list-foot {
    display: none;
  }
  .server {
    grid-template-columns: 64px auto minmax(0, 1fr) auto;
    grid-template-areas:
      'thumb name name ping'
      'thumb players night join';
    row-gap: 6px;
    column-gap: 10px;
  }
  .thumb {
    grid-area: thumb;
    aspect-ratio: 3 / 2;
  }
  #towns-back span {
    display: none;
  }
  .server .name {
    grid-area: name;
  }
  .server .players {
    grid-area: players;
    font-size: 14px;
  }
  .server .night {
    grid-area: night;
    font-size: 12px;
  }
  .ping {
    grid-area: ping;
    justify-self: end;
  }
  .server .join {
    grid-area: join;
    padding: 7px 14px;
  }
  .towns-head {
    flex-wrap: wrap;
    gap: 8px;
  }
  .towns-head h2 {
    order: -1;
    flex-basis: 100%;
    font-size: 20px;
  }
  #quick {
    flex: 1;
  }
}
