/* Online: lobby, rooms, profile, ranking, friends, chat, name plates around the board.
   Same palette as the menu (lavender cards with a solid "sticker" shadow, Fredoka, yellow main buttons). */
:root {
  --on-ink: #434276;
  --on-soft: #6b64a8;
  --on-card: #faf8ff;
  --on-line: #b7a8ee;
  --on-shadow: #9182d1;
  --on-pill: #ece8f7;
  --on-ok: #17a35b;
  --on-bad: #e0364e;
}

/* ---- main menu entry */
.menu-online {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 14px;
  width: 100%;
  margin: 10px 0 0;
  padding: 12px 22px;
  border: 3px solid #8fc7ff;
  border-radius: 22px;
  background: linear-gradient(180deg, #eaf6ff, #d4ebff);
  box-shadow: 0 5px 0 #6aa6e6;
  color: #1f4f86;
  font: 700 24px/1.1 var(--font-body);
  text-align: left;
  cursor: pointer;
  transition: transform 0.17s, box-shadow 0.17s;
}
.menu-online .online-globe {
  grid-row: span 2;
  font-size: 34px;
}
.menu-online small {
  font: 500 14px/1.3 var(--font-body);
  color: #3f6c9f;
}
.menu-online:hover {
  transform: translateY(-2px);
}
.menu-online:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #6aa6e6;
}

/* ---- online overlay */
.online-screen {
  z-index: 8;
  align-items: start;
  overflow: auto;
  background: rgba(53, 53, 105, 0.32);
}
.online-shell {
  position: relative;
  box-sizing: border-box;
  /* min-width: 0 keeps long rows (tabs, names) from widening the card past a phone screen. */
  min-width: 0;
  max-width: 100%;
  width: min(560px, 100%);
  margin: auto;
  padding: 18px 20px 22px;
  border: 3px solid var(--on-line);
  border-radius: 30px;
  background: var(--on-card);
  box-shadow: 0 8px 0 var(--on-shadow), 0 20px 46px #3d355436;
  color: var(--on-ink);
  text-align: center;
  animation: online-in 0.4s cubic-bezier(0.2, 1.2, 0.4, 1) both;
}
@keyframes online-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
}
.online-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.online-top .menu-back {
  margin: 0;
  justify-self: start;
  min-height: 44px;
}
.online-top h2 {
  margin: 0;
  font: 700 26px/1.1 var(--font-display);
}
.online-status {
  justify-self: end;
  font: 600 13px var(--font-body);
  color: var(--on-soft);
}
.online-view h3 {
  margin: 0 0 4px;
  font: 700 19px var(--font-display);
}
.box-note,
.modal-note {
  margin: 0 0 10px;
  font: 500 14px/1.45 var(--font-body);
  color: var(--on-soft);
}
.modal-note.small {
  font-size: 13px;
  margin-top: 12px;
}
.quick-box,
.room-box,
.room-code-box {
  margin: 12px 0;
  padding: 14px;
  border-radius: 22px;
  background: #fff;
  box-shadow: inset 0 0 0 2px #e6e1f8;
}
.quick-box .menu-play {
  height: 78px;
  font-size: 26px;
}

/* ---- account card */
.account-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-radius: 22px;
  background: linear-gradient(180deg, #fff, #f3f0fd);
  box-shadow: inset 0 0 0 2px #e6e1f8, 0 3px 0 #ddd6f6;
  color: var(--on-ink);
  text-align: left;
  cursor: pointer;
  font-family: var(--font-body);
}
.acc-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.acc-name {
  font: 700 19px/1.15 var(--font-display);
  overflow-wrap: anywhere;
}
.acc-sub {
  font: 500 13px/1.3 var(--font-body);
  color: var(--on-soft);
}
.acc-level {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 600 12px var(--font-body);
  color: var(--on-soft);
}
.lvl-star {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  clip-path: polygon(50% 0, 62% 33%, 98% 36%, 70% 58%, 80% 94%, 50% 74%, 20% 94%, 30% 58%, 2% 36%, 38% 33%);
  background: linear-gradient(180deg, #ffe26a, #ffb51e);
  color: #6a3c00;
  font: 700 12px/1 var(--font-body);
  font-style: normal;
  padding-top: 3px;
  box-sizing: border-box;
}
.lvl-bar {
  flex: 1;
  height: 10px;
  max-width: 180px;
  border-radius: 99px;
  background: #e4dff6;
  overflow: hidden;
}
.lvl-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8c7cf0, #b39cff);
}
.online-shell[data-view='ranking'] .account-card,
.online-shell[data-view='friends'] .account-card {
  padding: 6px 12px;
}
.online-shell[data-view='ranking'] .acc-sub,
.online-shell[data-view='friends'] .acc-sub {
  display: none;
}
.acc-go {
  font: 600 26px var(--font-body);
  color: var(--on-soft);
}

/* ---- avatars and frames */
.avatar {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #fff, #ece8fb);
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px #d9d3f3;
  overflow: visible;
}
.avatar canvas {
  width: 120%;
  height: auto;
  margin-top: 8%;
  clip-path: circle(42% at 50% 46%);
}
.avatar-s {
  width: 40px;
  height: 40px;
}
.avatar-m {
  width: 52px;
  height: 52px;
}
.avatar-l {
  width: 66px;
  height: 66px;
}
.empty-avatar {
  color: #b4acd8;
  font: 700 22px var(--font-body);
}
.avatar[data-frame='paw'],
.plate[data-frame='paw'] .plate-avatar {
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px #f6a6b8;
}
.avatar[data-frame='bronze'],
.plate[data-frame='bronze'] .plate-avatar {
  box-shadow: 0 0 0 3px #f3d9bd, 0 0 0 6px #b4733a;
}
.avatar[data-frame='silver'],
.plate[data-frame='silver'] .plate-avatar {
  box-shadow: 0 0 0 3px #f2f4f8, 0 0 0 6px #95a1b6;
}
.avatar[data-frame='gold'],
.plate[data-frame='gold'] .plate-avatar {
  box-shadow: 0 0 0 3px #fff3c0, 0 0 0 6px #e8a510, 0 0 12px #ffcf3f88;
}
.avatar[data-frame='star'],
.plate[data-frame='star'] .plate-avatar {
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px #8c7cf0, 0 0 14px #b39cffaa;
}
.avatar[data-frame='rainbow'],
.plate[data-frame='rainbow'] .plate-avatar {
  box-shadow: 0 0 0 3px #fff, 0 0 0 4px #f04c50, 0 0 0 5px #ffc928, 0 0 0 6px #17b566, 0 0 0 7px #2f7cf6;
}
.avatar[data-frame='paw']::after,
.avatar[data-frame='star']::after,
.avatar[data-frame='gold']::after {
  content: '';
  position: absolute;
  right: -5px;
  bottom: -3px;
  width: 16px;
  height: 16px;
  -webkit-mask: var(--frame-icon) center / contain no-repeat;
  mask: var(--frame-icon) center / contain no-repeat;
  filter: drop-shadow(0 1px 0 #fff) drop-shadow(0 -1px 0 #fff);
}
.avatar[data-frame='paw']::after {
  --frame-icon: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 512 512%22%3E%3Cpath d=%22M226.5 92.9c14.3 42.9-.3 86.2-32.6 96.8s-70.1-15.6-84.4-58.5s.3-86.2 32.6-96.8s70.1 15.6 84.4 58.5zM100.4 198.6c18.9 32.4 14.3 70.1-10.2 84.1s-59.7-.9-78.5-33.3S-2.7 179.3 21.8 165.3s59.7 .9 78.5 33.3zM69.2 401.2C121.6 259.9 214.7 224 256 224s134.4 35.9 186.8 177.2c3.6 9.7 5.2 20.1 5.2 30.5l0 1.6c0 25.8-20.9 46.7-46.7 46.7c-11.5 0-22.9-1.4-34-4.2l-88-22c-15.3-3.8-31.3-3.8-46.6 0l-88 22c-11.1 2.8-22.5 4.2-34 4.2C84.9 480 64 459.1 64 433.3l0-1.6c0-10.4 1.6-20.8 5.2-30.5zM421.8 282.7c-24.5-14-29.1-51.7-10.2-84.1s54-47.3 78.5-33.3s29.1 51.7 10.2 84.1s-54 47.3-78.5 33.3zM310.1 189.7c-32.3-10.6-46.9-53.9-32.6-96.8s52.1-69.1 84.4-58.5s46.9 53.9 32.6 96.8s-52.1 69.1-84.4 58.5z%22/%3E%3C/svg%3E");
  background: #b0703c;
}
.avatar[data-frame='star']::after {
  --frame-icon: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 576 512%22%3E%3Cpath d=%22M316.9 18C311.6 7 300.4 0 288.1 0s-23.4 7-28.8 18L195 150.3 51.4 171.5c-12 1.8-22 10.2-25.7 21.7s-.7 24.2 7.9 32.7L137.8 329 113.2 474.7c-2 12 3 24.2 12.9 31.3s23 8 33.8 2.3l128.3-68.5 128.3 68.5c10.8 5.7 23.9 4.9 33.8-2.3s14.9-19.3 12.9-31.3L438.5 329 542.7 225.9c8.6-8.5 11.7-21.2 7.9-32.7s-13.7-19.9-25.7-21.7L381.2 150.3 316.9 18z%22/%3E%3C/svg%3E");
  background: #f5b400;
}
.avatar[data-frame='gold']::after {
  --frame-icon: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 576 512%22%3E%3Cpath d=%22M309 106c11.4-7 19-19.7 19-34c0-22.1-17.9-40-40-40s-40 17.9-40 40c0 14.4 7.6 27 19 34L209.7 220.6c-9.1 18.2-32.7 23.4-48.6 10.7L72 160c5-6.7 8-15 8-24c0-22.1-17.9-40-40-40S0 113.9 0 136s17.9 40 40 40c.2 0 .5 0 .7 0L86.4 427.4c5.5 30.4 32 52.6 63 52.6l277.2 0c30.9 0 57.4-22.1 63-52.6L535.3 176c.2 0 .5 0 .7 0c22.1 0 40-17.9 40-40s-17.9-40-40-40s-40 17.9-40 40c0 9 3 17.3 8 24l-89.1 71.3c-15.9 12.7-39.5 7.5-48.6-10.7L309 106z%22/%3E%3C/svg%3E");
  background: #e3a400;
}

/* ---- segmented choices, buttons, inputs */
.seg-label {
  display: block;
  margin: 10px 2px -4px;
  text-align: left;
  font: 600 12px var(--font-body);
  color: var(--on-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.seg {
  display: flex;
  gap: 6px;
  margin: 8px 0;
  padding: 4px;
  border-radius: 16px;
  background: var(--on-pill);
}
.seg button {
  flex: 1;
  min-width: 0;
  padding: 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--on-soft);
  font: 600 15px var(--font-body);
  cursor: pointer;
}
.seg button[aria-pressed='true'] {
  background: #fff;
  color: var(--on-ink);
  box-shadow: 0 2px 0 #d4ccf2;
}
.seg button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.big-btn,
.small-btn,
.ghost-btn,
.danger-btn,
.link-btn {
  font-family: var(--font-body);
  cursor: pointer;
}
.big-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 20px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, #8b78f5, #6a55e0);
  box-shadow: 0 4px 0 #4b3cb0;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
}
#btnCreateRoom {
  width: 100%;
  margin: 6px 0 10px;
}
.big-btn:active,
.small-btn:active {
  transform: translateY(3px);
  box-shadow: none;
}
.small-btn {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: #ebe7fb;
  box-shadow: 0 2px 0 #d4ccf2;
  color: var(--on-ink);
  font-weight: 600;
  font-size: 14px;
}
.small-btn:disabled {
  opacity: 0.6;
}
.ghost-btn {
  min-height: 46px;
  border: 2px solid #d4cff1;
  border-radius: 16px;
  background: #fff;
  color: var(--on-ink);
  font-weight: 600;
  font-size: 15px;
}
.danger-btn {
  min-height: 46px;
  border: 2px solid #f6b8c2;
  border-radius: 16px;
  background: #fff4f6;
  color: #b12941;
  font-weight: 600;
  font-size: 15px;
}
.small-btn.danger-btn {
  min-height: 40px;
}
.wide-btn {
  width: 100%;
  margin-top: 10px;
}
.link-btn {
  margin-top: 10px;
  border: 0;
  background: none;
  color: var(--on-soft);
  text-decoration: underline;
  font-size: 14px;
  min-height: 40px;
}
.small-play {
  height: 72px;
  font-size: 22px;
}
.join-form {
  display: flex;
  gap: 8px;
}
.join-form input,
.field input,
.name-form input,
.chat-form input {
  flex: 1;
  min-width: 0;
  min-height: 50px;
  box-sizing: border-box;
  padding: 0 14px;
  border: 2px solid #d4cff1;
  border-radius: 14px;
  background: #fff;
  color: var(--on-ink);
  font: 600 18px var(--font-body);
}
#joinCode {
  letter-spacing: 4px;
  text-transform: uppercase;
  text-align: center;
}
input:focus-visible {
  outline: 3px solid #7566ba;
  outline-offset: 1px;
}
.online-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 6px;
}
.online-tabs button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 64px;
  border: 0;
  border-radius: 18px;
  background: #fff;
  box-shadow: inset 0 0 0 2px #e6e1f8, 0 3px 0 #ddd6f6;
  color: var(--on-ink);
  font: 600 14px var(--font-body);
  cursor: pointer;
}
.online-tabs button span:first-child {
  font-size: 22px;
}

/* ---- searching */
.search-anim {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 20px 0 10px;
  font-size: 40px;
}
.search-anim span {
  animation: search-hop 1s ease-in-out infinite;
}
.search-anim span:nth-child(2) {
  animation-delay: 0.15s;
}
.search-anim span:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes search-hop {
  50% {
    transform: translateY(-14px);
  }
}
.search-title {
  font: 700 22px var(--font-display);
  margin: 6px 0;
}
.search-line {
  margin: 4px 0;
  font: 500 15px var(--font-body);
  color: var(--on-soft);
}

/* ---- room */
.room-code-box small {
  display: block;
  font: 600 13px var(--font-body);
  color: var(--on-soft);
}
.room-code {
  display: block;
  margin: 2px 0;
  font: 700 46px/1.1 var(--font-display);
  letter-spacing: 8px;
  color: #6253c4;
}
.room-link {
  display: none;
  font: 500 12px var(--font-body);
  color: #9b95bd;
  overflow-wrap: anywhere;
}
.room-share {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 10px;
}
.room-share .small-btn {
  padding: 0 6px;
  font-size: 13px;
}
.room-mode {
  margin: 4px 0 8px;
  font: 600 15px var(--font-body);
  color: var(--on-soft);
}
.room-seats,
.rank-list,
.friend-list,
.ach-list,
.chat-log {
  list-style: none;
  margin: 0;
  padding: 0;
}
.room-seats {
  display: grid;
  gap: 8px;
}
.room-seat {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 6px 12px;
  border-radius: 18px;
  background: #fff;
  box-shadow: inset 4px 0 0 var(--cc), inset 0 0 0 2px #e6e1f8;
  text-align: left;
}
.room-seat.me {
  box-shadow: inset 4px 0 0 var(--cc), inset 0 0 0 2px var(--cc);
}
.room-seat.empty {
  background: #f7f5fe;
  box-shadow: none;
  outline: 2px dashed #d4ccf2;
  outline-offset: -2px;
}
.room-seat.empty .avatar {
  filter: grayscale(0.55);
  opacity: 0.8;
}
.room-seat.empty .seat-text {
  color: var(--on-soft);
}
.room-seat.joined .avatar {
  animation: seat-hop 0.6s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
@keyframes seat-hop {
  0% {
    transform: translateY(-26px) scale(0.6);
    opacity: 0;
  }
  60% {
    transform: translateY(3px) scale(1.06);
    opacity: 1;
  }
}
.seat-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  font: 600 15px var(--font-body);
}
.seat-text b {
  font: 700 17px var(--font-body);
  overflow-wrap: anywhere;
}
.seat-text small {
  font-weight: 500;
  color: var(--on-soft);
}
.room-seat.clickable .seat-text {
  cursor: pointer;
}
.seat-host {
  padding: 3px 9px;
  border-radius: 99px;
  background: #fff1c2;
  color: #855a00;
  font: 700 12px var(--font-body);
}
.seat-kick {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: #fff0f3;
  color: #b12941;
  font: 600 22px/1 var(--font-body);
  cursor: pointer;
}
.room-host {
  margin-top: 10px;
}
.room-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
#btnRoomChat {
  position: relative;
}
#btnRoomChat .badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  border-radius: 99px;
  background: var(--on-bad);
  color: #fff;
  font: 700 12px/20px var(--font-body);
}
.room-wait {
  min-height: 1.4em;
  margin: 10px 0 0;
  font: 500 15px var(--font-body);
  color: var(--on-soft);
}
#onRoom .menu-play {
  position: sticky;
  bottom: 8px;
  z-index: 2;
  height: 84px;
  font-size: 28px;
}

/* ---- ranking, friends, lists */
.rank-row,
.friend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 6px;
  border-radius: 16px;
  background: #fff;
  box-shadow: inset 0 0 0 2px #ece8f9;
  text-align: left;
  cursor: pointer;
}
.rank-row.me {
  box-shadow: inset 0 0 0 2px #8c7cf0;
  background: #f4f1ff;
}
.rank-pos {
  width: 34px;
  text-align: center;
  font: 700 18px var(--font-display);
  color: var(--on-soft);
}
.rank-name,
.friend-name {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  font: 600 15px var(--font-body);
}
.rank-name b,
.friend-name b {
  overflow-wrap: anywhere;
}
.rank-name small,
.friend-name small {
  color: var(--on-soft);
  font-weight: 500;
}
.friend-name small.is-online {
  color: var(--on-ok);
}
.friend-name small.is-online::before {
  content: '● ';
}
.rank-points {
  font: 700 16px var(--font-body);
  color: #6253c4;
  white-space: nowrap;
}
.my-rank {
  margin: 10px 0 0;
  font: 600 15px var(--font-body);
}
.list-title {
  margin: 14px 0 6px !important;
  text-align: left;
  font-size: 16px !important;
}
.empty-line {
  padding: 14px;
  color: var(--on-soft);
  font: 500 15px/1.4 var(--font-body);
}
.my-code {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
  font: 600 14px var(--font-body);
  color: var(--on-soft);
}
.my-code b {
  font: 700 26px var(--font-display);
  letter-spacing: 4px;
  color: #6253c4;
}
.pending {
  color: var(--on-soft);
  font: 500 13px var(--font-body);
}

/* ---- profile */
.name-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 10px;
}
.field-label {
  font: 600 14px var(--font-body);
  color: var(--on-soft);
}
.stat-hero {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.stat-hero div {
  padding: 10px 6px;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, #f3f0fd);
  box-shadow: inset 0 0 0 2px #e6e1f8, 0 3px 0 #ddd6f6;
}
.stat-hero b {
  display: block;
  font: 700 28px/1.1 var(--font-display);
  color: #6253c4;
}
.stat-hero small {
  font: 600 12px var(--font-body);
  color: var(--on-soft);
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px 6px;
  color: var(--on-soft);
  font: 500 15px/1.4 var(--font-body);
}
.empty-state canvas {
  width: 112px;
  height: 88px;
  animation: empty-breathe 3s ease-in-out infinite;
}
@keyframes empty-breathe {
  50% {
    transform: scale(1.04, 0.97);
  }
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin: 8px 0 0;
}
.stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff;
  box-shadow: inset 0 0 0 2px #ece8f9;
}
.stat dt {
  font: 500 14px var(--font-body);
  color: var(--on-soft);
  text-align: left;
}
.stat dd {
  margin: 0;
  font: 700 18px var(--font-body);
  color: var(--on-ink);
}
.ach {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 18px;
  background: #fffaf0;
  box-shadow: inset 0 0 0 2px #f1e3c4;
  text-align: left;
}
.ach-medals {
  display: flex;
  gap: 3px;
}
.ach-medals i {
  display: grid;
  place-items: center;
  width: 22px;
  height: 26px;
  border-radius: 50% 50% 46% 46%;
  background: #fff;
  box-shadow: inset 0 0 0 2px #e8dcc0;
}
.ach-medals i::after {
  content: '';
  width: 11px;
  height: 11px;
  background: #6b5a3a;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 512 512%22%3E%3Cpath d=%22M226.5 92.9c14.3 42.9-.3 86.2-32.6 96.8s-70.1-15.6-84.4-58.5s.3-86.2 32.6-96.8s70.1 15.6 84.4 58.5zM100.4 198.6c18.9 32.4 14.3 70.1-10.2 84.1s-59.7-.9-78.5-33.3S-2.7 179.3 21.8 165.3s59.7 .9 78.5 33.3zM69.2 401.2C121.6 259.9 214.7 224 256 224s134.4 35.9 186.8 177.2c3.6 9.7 5.2 20.1 5.2 30.5l0 1.6c0 25.8-20.9 46.7-46.7 46.7c-11.5 0-22.9-1.4-34-4.2l-88-22c-15.3-3.8-31.3-3.8-46.6 0l-88 22c-11.1 2.8-22.5 4.2-34 4.2C84.9 480 64 459.1 64 433.3l0-1.6c0-10.4 1.6-20.8 5.2-30.5zM421.8 282.7c-24.5-14-29.1-51.7-10.2-84.1s54-47.3 78.5-33.3s29.1 51.7 10.2 84.1s-54 47.3-78.5 33.3zM310.1 189.7c-32.3-10.6-46.9-53.9-32.6-96.8s52.1-69.1 84.4-58.5s46.9 53.9 32.6 96.8s-52.1 69.1-84.4 58.5z%22/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 512 512%22%3E%3Cpath d=%22M226.5 92.9c14.3 42.9-.3 86.2-32.6 96.8s-70.1-15.6-84.4-58.5s.3-86.2 32.6-96.8s70.1 15.6 84.4 58.5zM100.4 198.6c18.9 32.4 14.3 70.1-10.2 84.1s-59.7-.9-78.5-33.3S-2.7 179.3 21.8 165.3s59.7 .9 78.5 33.3zM69.2 401.2C121.6 259.9 214.7 224 256 224s134.4 35.9 186.8 177.2c3.6 9.7 5.2 20.1 5.2 30.5l0 1.6c0 25.8-20.9 46.7-46.7 46.7c-11.5 0-22.9-1.4-34-4.2l-88-22c-15.3-3.8-31.3-3.8-46.6 0l-88 22c-11.1 2.8-22.5 4.2-34 4.2C84.9 480 64 459.1 64 433.3l0-1.6c0-10.4 1.6-20.8 5.2-30.5zM421.8 282.7c-24.5-14-29.1-51.7-10.2-84.1s54-47.3 78.5-33.3s29.1 51.7 10.2 84.1s-54 47.3-78.5 33.3zM310.1 189.7c-32.3-10.6-46.9-53.9-32.6-96.8s52.1-69.1 84.4-58.5s46.9 53.9 32.6 96.8s-52.1 69.1-84.4 58.5z%22/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: 0.25;
}
.ach-medals i.on::after {
  opacity: 0.9;
  background: #fff;
}
.ach-medals i.on.bronze {
  background: linear-gradient(180deg, #e8a66b, #b4733a);
}
.ach-medals i.on.silver {
  background: linear-gradient(180deg, #e9edf3, #95a1b6);
}
.ach-medals i.on.gold {
  background: linear-gradient(180deg, #ffe26a, #e8a510);
}
.ach-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font: 500 13px var(--font-body);
  color: var(--on-soft);
}
.ach-text b {
  font: 700 16px var(--font-body);
  color: var(--on-ink);
}
.ach-bar {
  position: relative;
  height: 12px;
  margin: 6px 52px 0 0;
  border-radius: 99px;
  background: #efe3cc;
}
.ach-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffd34d, #ffad1f);
}
.ach-bar em {
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  translate: 0 -50%;
  white-space: nowrap;
  font: 700 12px var(--font-body);
  font-style: normal;
  color: var(--on-soft);
}
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 8px;
}
.frame-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
}
.avatar-pick,
.frame-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 60px;
  padding: 8px 4px;
  border: 0;
  border-radius: 16px;
  background: #fff;
  box-shadow: inset 0 0 0 2px #ece8f9;
  color: var(--on-soft);
  font: 600 12px var(--font-body);
  cursor: pointer;
}
.avatar-pick[aria-pressed='true'],
.frame-pick[aria-pressed='true'] {
  box-shadow: inset 0 0 0 3px #8c7cf0;
  background: #f4f1ff;
}
.frame-pick:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.account-pane {
  padding-top: 6px;
}

/* ---- modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  padding: 16px;
  background: #45426a66;
  backdrop-filter: blur(3px);
}
.modal-card {
  box-sizing: border-box;
  width: min(460px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 20px 22px 24px;
  border: 3px solid var(--on-line);
  border-radius: 28px;
  background: var(--on-card);
  box-shadow: 0 7px 0 var(--on-shadow), 0 18px 40px #3d355436;
  color: var(--on-ink);
  text-align: center;
  animation: online-in 0.3s ease both;
}
.modal-card .aux-head {
  margin-bottom: 10px;
}
.modal-card .aux-head h2 {
  font-size: 24px;
}
.modal-card .aux-head button {
  border: 0;
  border-radius: 14px;
  background: var(--on-pill);
  color: var(--on-ink);
  cursor: pointer;
}
.account-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font: 600 14px var(--font-body);
  color: var(--on-soft);
}
.form-msg {
  min-height: 1.2em;
  margin: 0;
  color: var(--on-bad);
  font: 600 14px var(--font-body);
}
.card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
  text-align: left;
}
.card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

/* ---- name plates around the board */
.plates {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
body:not(.online-game) .plates,
body.menu-open .plates {
  display: none;
}
/* Online everybody watches the same pace (no 1×/2×) and the server plays the CPU seats (no difficulty). */
body.online-game #btnSpeed,
body.online-game .speed-row,
body.online-game .cpu-row {
  display: none;
}
.plate {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 190px;
  padding: 4px 12px 4px 4px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--cc) 45%, #c9c3ea), inset 0 0 0 2px color-mix(in srgb, var(--cc) 35%, #fff);
  color: var(--on-ink);
  font-family: var(--font-body);
  text-align: left;
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s, opacity 0.25s;
}
.plate[data-side^='l'] {
  transform: translateX(0);
}
.plate[data-side^='r'] {
  flex-direction: row-reverse;
  padding: 4px 4px 4px 12px;
  text-align: right;
  translate: -100% 0;
}
.plate[data-side$='to'] {
  translate: 0 -100%;
}
.plate[data-side='rto'] {
  translate: -100% -100%;
}
.plate[data-side$='ti'],
.plate[data-side$='bi'] {
  scale: 0.86;
}
.plate[data-side='lti'],
.plate[data-side='lbi'] {
  translate: 6px -50%;
}
.plate[data-side='rti'],
.plate[data-side='rbi'] {
  translate: calc(-100% - 6px) -50%;
}
.plate.turn {
  box-shadow: 0 3px 0 color-mix(in srgb, var(--cc) 70%, #000), 0 0 0 3px var(--cc), 0 0 18px color-mix(in srgb, var(--cc) 70%, transparent);
  transform: translateY(-2px) scale(1.04);
}
.plate.away {
  opacity: 0.72;
}
.plate-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #fff, color-mix(in srgb, var(--cc) 22%, #fff));
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px color-mix(in srgb, var(--cc) 55%, #fff);
}
.plate-avatar canvas {
  width: 48px;
  height: 38px;
  margin-top: 4px;
  clip-path: circle(19px at 50% 44%);
}
.plate-ring {
  position: absolute;
  inset: -5px;
  width: 50px;
  height: 50px;
  transform: rotate(-90deg);
  pointer-events: none;
}
.plate-ring circle {
  fill: none;
  stroke: var(--cc);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: calc(var(--left, 0) * 100) 100;
  /* A zero-length dash with a round cap still paints a dot at the top: hide the ring when no time is running. */
  opacity: calc(var(--left, 0) * 1000);
  transition: stroke-dasharray 0.1s linear;
}
.plate.hurry .plate-ring circle {
  stroke: #e0364e;
}
.plate.hurry .plate-avatar {
  animation: plate-hurry 0.5s ease-in-out infinite;
}
@keyframes plate-hurry {
  50% {
    transform: scale(1.08);
  }
}
.plate-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.1;
}
.plate-name {
  font: 700 14px var(--font-body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plate-sub {
  font: 500 12px var(--font-body);
  color: var(--on-soft);
  white-space: nowrap;
}
.plate.me .plate-name::after {
  content: ' ★';
  color: var(--cc);
}
.plate-bubble {
  position: absolute;
  left: 10px;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: 220px;
  padding: 9px 14px;
  border-radius: 18px 18px 18px 5px;
  background: #fff;
  box-shadow: 0 3px 0 color-mix(in srgb, var(--cc) 40%, #d9d3f3), 0 8px 20px #3d355440;
  color: var(--on-ink);
  font: 700 16px/1.3 var(--font-body);
  z-index: 2;
  white-space: normal;
  overflow-wrap: anywhere;
  pointer-events: none;
}
.plate[data-side^='r'] .plate-bubble {
  left: auto;
  right: 10px;
  border-radius: 16px 16px 4px 16px;
}
.plate[data-side$='to'] .plate-bubble,
.plate[data-side='lti'] .plate-bubble,
.plate[data-side='rti'] .plate-bubble {
  bottom: auto;
  top: calc(100% + 8px);
}
.plate-bubble.emoji {
  font-size: 30px;
  padding: 2px 10px;
}
.plate-bubble.pop {
  animation: bubble-pop 0.35s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
@keyframes bubble-pop {
  from {
    opacity: 0;
    transform: scale(0.4) translateY(8px);
  }
}

/* ---- chat drawer, invite, toast */
.chat-btn {
  position: relative;
  font-size: 20px;
}
.chat-btn .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--on-bad);
  color: #fff;
  font: 700 11px/18px var(--font-body);
}
.chat {
  position: fixed;
  z-index: 11;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box;
  width: min(380px, calc(100vw - 24px));
  max-height: min(560px, calc(100dvh - 90px));
  padding: 12px;
  border: 3px solid var(--on-line);
  border-radius: 24px;
  background: var(--on-card);
  box-shadow: 0 6px 0 var(--on-shadow), 0 18px 40px #3d355440;
  color: var(--on-ink);
  animation: online-in 0.25s ease both;
}
.chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font: 700 18px var(--font-display);
}
.chat-head button {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: var(--on-pill);
  color: var(--on-ink);
  font: 500 24px/1 var(--font-body);
  cursor: pointer;
}
.chat-log {
  flex: 1;
  min-height: 80px;
  max-height: 220px;
  overflow: auto;
  padding: 4px;
  border-radius: 14px;
  background: #fff;
  box-shadow: inset 0 0 0 2px #ece8f9;
  text-align: left;
}
.chat-line {
  padding: 4px 6px;
  font: 500 14px/1.35 var(--font-body);
  overflow-wrap: anywhere;
}
.chat-line b {
  color: color-mix(in srgb, var(--cc) 80%, #222);
  margin-right: 6px;
}
.chat-line.system {
  color: var(--on-soft);
  font-style: italic;
}
.chat-emoji {
  font-size: 22px;
}
.chat-emojis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 4px;
}
.emoji-btn {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: #fff;
  box-shadow: inset 0 0 0 2px #ece8f9;
  font-size: 22px;
  cursor: pointer;
}
.emoji-btn:active,
.phrase-btn:active {
  transform: scale(0.92);
}
.chat-phrases {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.phrase-btn {
  min-height: 44px;
  padding: 0 11px;
  border: 0;
  border-radius: 99px;
  background: var(--on-pill);
  color: var(--on-ink);
  font: 600 13px var(--font-body);
  cursor: pointer;
}
.chat-form {
  display: flex;
  gap: 6px;
}
.chat-form input {
  min-height: 44px;
  font-size: 15px;
}
.chat-form button {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #8b78f5, #6a55e0);
  color: #fff;
  font: 700 15px var(--font-body);
  cursor: pointer;
}
.chat-off {
  margin: 0;
  font: 500 12px var(--font-body);
  color: var(--on-soft);
}
.invite {
  position: fixed;
  z-index: 13;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 24px);
  padding: 10px 10px 10px 16px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 5px 0 var(--on-shadow), 0 14px 30px #3d355440;
  color: var(--on-ink);
  font: 600 15px var(--font-body);
  animation: online-in 0.3s ease both;
}
.invite button {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: #ebe7fb;
  color: var(--on-ink);
  font: 700 14px var(--font-body);
  cursor: pointer;
}
#inviteAccept {
  background: linear-gradient(180deg, #ffe26a, #ffb51e);
  color: #6a3c00;
}
.toast {
  position: fixed;
  z-index: 14;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  translate: -50% 0;
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border-radius: 16px;
  background: #343363;
  color: #fff;
  font: 600 15px var(--font-body);
  box-shadow: 0 8px 24px #0004;
}
.net-notice {
  position: fixed;
  z-index: 15;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: calc(100vw - 24px);
  padding: 8px 8px 8px 14px;
  border-radius: 16px;
  background: #343363;
  color: #fff;
  font: 600 14px/1.35 var(--font-body);
  box-shadow: 0 8px 24px #0004;
  animation: online-in 0.25s ease both;
}
.net-notice button {
  flex: none;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: #ffffff22;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.toast[data-kind='error'] {
  background: #b12941;
}
.toast.show {
  animation: online-in 0.25s ease both;
}
.proof-note {
  border: 0;
  cursor: pointer;
  font-family: var(--font-body);
}
.proof-note.ok {
  background: #dff7e9;
  color: #106b3c;
}

@media (max-width: 480px) {
  .profile-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .online-shell {
    padding: 14px 12px 18px;
    border-radius: 24px;
  }
  .menu-online {
    font-size: 20px;
    padding: 10px 16px;
  }
  .plate {
    max-width: 150px;
    padding-right: 9px;
  }
  .plate-name {
    font-size: 13px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .online-shell,
  .room-seat,
  .search-anim span,
  .plate-bubble.pop,
  .plate.hurry .plate-avatar,
  .modal-card,
  .room-seat.joined .avatar,
  .empty-state canvas,
  .chat,
  .invite,
  .toast.show {
    animation: none;
  }
}

/* End of css/online.css */

/* Interface icons (the game draws no emoji outside the match reactions). */
.ui-icon {
  display: inline-flex;
  width: 1.1em;
  height: 1.1em;
  flex: none;
  vertical-align: -0.15em;
}
.ui-icon svg {
  width: 100%;
  height: 100%;
}
.menu-online .online-globe {
  width: 34px;
  height: 34px;
  color: #2f7cf6;
}
.search-anim .ui-icon {
  width: 40px;
  height: 40px;
  color: #8c7cf0;
}
.rank-pos.medal-1 { color: #e3a400; }
.rank-pos.medal-2 { color: #8e9ab0; }
.rank-pos.medal-3 { color: #b4733a; }
.rank-pos .ui-icon { width: 20px; height: 20px; }

/* ---- mobile pass (29/10/2026): room fits a phone, host options before the seats */
.room-host {
  margin: 6px 0 10px;
}
.room-host:not([hidden]) + .room-mode {
  display: none;
}
.room-seat {
  min-height: 52px;
  padding: 4px 12px;
}
.room-seat .avatar-m {
  width: 42px;
  height: 42px;
}
#onRoom .menu-play {
  height: 60px;
  font-size: 22px;
  margin-top: 8px;
  filter: drop-shadow(0 -6px 10px rgba(246, 243, 255, 0.95));
}
@media (max-height: 760px) {
  .room-code {
    font-size: 36px;
    letter-spacing: 6px;
  }
  .room-share {
    margin-top: 6px;
  }
  .room-share .small-btn {
    min-height: 44px;
  }
}

/* Chat on phones: one sliding row of reactions and one of phrases; during a match it opens at the top so the dice stays free. */
@media (max-width: 600px) {
  .chat {
    gap: 6px;
    padding: 10px;
  }
  .chat-emojis,
  .chat-phrases {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 -4px;
    padding: 0 4px;
  }
  .chat-emojis::-webkit-scrollbar,
  .chat-phrases::-webkit-scrollbar {
    display: none;
  }
  .emoji-btn {
    flex: none;
    width: 46px;
  }
  .phrase-btn {
    flex: none;
    white-space: nowrap;
  }
  .chat-log {
    min-height: 64px;
    max-height: 120px;
  }
  body.online-game .chat {
    top: max(64px, calc(env(safe-area-inset-top) + 56px));
    bottom: auto;
    max-height: calc(100dvh - 300px);
  }
  body.online-game .chat-log {
    max-height: 72px;
  }
}

/* Online hub on short phones: everything up to "Create room" without scrolling. */
.quick-box .menu-play {
  height: 64px;
  font-size: 22px;
}
@media (max-height: 760px) {
  .quick-box .box-note,
  .online-shell[data-view='home'] .acc-sub {
    display: none;
  }
  .quick-box,
  .room-box {
    margin: 8px 0;
    padding: 10px 12px;
  }
  .account-card .avatar-l {
    width: 52px;
    height: 52px;
  }
  .quick-box .menu-play {
    height: 56px;
    font-size: 20px;
  }
  .seg-label {
    margin-top: 6px;
  }
}
.acc-level small,
.acc-xp {
  font-size: 12px;
}

/* Second review pass: sticky start button sits on a solid strip, hub tabs in one row on short phones. */
#onRoom .menu-play {
  border-radius: 22px;
  box-shadow: 0 0 0 10px var(--on-card);
}
.room-wait {
  margin-bottom: 4px;
}
.online-tabs .ui-icon {
  width: 22px;
  height: 22px;
}
@media (max-height: 760px) {
  .online-tabs button {
    flex-direction: row;
    justify-content: center;
    gap: 6px;
    min-height: 48px;
  }
}
.online-shell[data-view='search'] #onlineBack {
  visibility: hidden;
}
.ghost-btn .ui-icon {
  margin-right: 6px;
}
.phrase-btn {
  min-width: 48px;
}
