:root {
  --ink: #17121f;
  --ink-soft: #31283d;
  --cream: #fffaf1;
  --paper: #ffffff;
  --muted: #756c7d;
  --line: #ded6e3;
  --acid: #caff3d;
  --pink: #ff4f9a;
  --violet: #8a64ff;
  --blue: #55c7ff;
  --orange: #ff8a3d;
  --yellow: #ffd84d;
  --danger: #e4425d;
  --shadow: 0 8px 0 var(--ink);
  --soft-shadow: 0 18px 50px rgba(23, 18, 31, 0.15);
  font-family: Inter, ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--cream);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--ink);
}

body {
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 8%, rgba(202, 255, 61, 0.16), transparent 29rem),
    radial-gradient(circle at 90% 60%, rgba(255, 79, 154, 0.17), transparent 26rem),
    var(--cream);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  content: "";
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 140 140' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.15'/%3E%3C/svg%3E");
  pointer-events: none;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 240px;
  height: 240px;
  border: 3px solid var(--ink);
  pointer-events: none;
}

.ambient-one {
  top: -155px;
  right: -105px;
  border-radius: 42% 58% 67% 33% / 45% 34% 66% 55%;
  background: var(--acid);
  transform: rotate(22deg);
}

.ambient-two {
  bottom: -178px;
  left: -120px;
  border-radius: 60% 40% 34% 66% / 47% 61% 39% 53%;
  background: var(--pink);
  transform: rotate(-18deg);
}

.app-shell {
  width: min(100%, 560px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
}

.loading-screen {
  min-height: calc(100dvh - 50px);
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  color: var(--muted);
}

.mini-logo {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: var(--acid);
  box-shadow: 5px 5px 0 var(--ink);
  font-size: 22px;
  font-weight: 1000;
  transform: rotate(-5deg);
}

.loading-dots {
  display: flex;
  gap: 6px;
}

.loading-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--violet);
  animation: bounce 0.8s infinite alternate;
}

.loading-dots i:nth-child(2) { animation-delay: 0.16s; }
.loading-dots i:nth-child(3) { animation-delay: 0.32s; }

@keyframes bounce {
  to { transform: translateY(-8px); }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.brand-small {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 1000;
  letter-spacing: -0.04em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 2px solid var(--ink);
  border-radius: 11px;
  background: var(--acid);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 13px;
  transform: rotate(-4deg);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 20px;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.icon-button:active {
  box-shadow: 1px 1px 0 var(--ink);
  transform: translate(2px, 2px);
}

.chat-trigger {
  position: relative;
}

.unread-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  display: grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--pink);
  color: white;
  font-size: 9px;
  font-weight: 1000;
  line-height: 1;
}

.hero {
  padding: 25px 0 28px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 14px;
  padding: 7px 11px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--acid);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  transform: rotate(-1.5deg);
}

.hero h1 {
  max-width: 490px;
  margin: 0;
  font-size: clamp(52px, 16vw, 86px);
  font-weight: 1000;
  letter-spacing: -0.08em;
  line-height: 0.84;
  text-transform: uppercase;
}

.hero h1 span {
  position: relative;
  display: inline-block;
  color: var(--pink);
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 4px 4px 0 var(--ink);
  transform: rotate(-2deg);
}

.hero-copy {
  max-width: 400px;
  margin: 24px 0 0;
  color: var(--ink-soft);
  font-size: 17px;
  font-weight: 650;
  line-height: 1.5;
}

.panel {
  padding: 22px;
  border: 3px solid var(--ink);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.panel + .panel {
  margin-top: 22px;
}

.panel-title {
  margin: 0 0 5px;
  font-size: 22px;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.panel-copy {
  margin: 0 0 19px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field-label {
  display: block;
  margin: 0 0 8px 2px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.input {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border: 2px solid var(--ink);
  border-radius: 15px;
  outline: none;
  background: var(--cream);
  color: var(--ink);
  font-size: 16px;
  font-weight: 750;
  transition: box-shadow 150ms ease, background 150ms ease;
}

.input::placeholder {
  color: #aaa0b1;
  font-weight: 600;
}

.input:focus {
  background: var(--paper);
  box-shadow: 0 0 0 4px rgba(138, 100, 255, 0.25);
}

.code-input {
  text-align: center;
  font-size: 22px;
  font-weight: 1000;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 55px;
  padding: 12px 18px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: var(--acid);
  box-shadow: 5px 5px 0 var(--ink);
  color: var(--ink);
  font-size: 16px;
  font-weight: 950;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.button:hover { filter: brightness(0.98); }

.button:active:not(:disabled) {
  box-shadow: 2px 2px 0 var(--ink);
  transform: translate(3px, 3px);
}

.button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.5);
  opacity: 0.55;
}

.button.pink { background: var(--pink); color: #fff; }
.button.violet { background: var(--violet); color: #fff; }
.button.white { background: var(--paper); }
.button.ghost { border-color: var(--line); background: transparent; box-shadow: none; }
.button.danger { border-color: var(--danger); background: #fff1f3; box-shadow: none; color: var(--danger); }
.button.compact { width: auto; min-height: 44px; padding: 8px 14px; border-width: 2px; box-shadow: 3px 3px 0 var(--ink); font-size: 14px; }

.button-spinner {
  width: 18px;
  height: 18px;
  border: 3px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 27px 0 22px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.divider::before,
.divider::after {
  height: 2px;
  flex: 1;
  content: "";
  background: var(--line);
}

.tiny-note {
  margin: 25px auto 0;
  max-width: 420px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
}

.join-hero {
  padding: 36px 0 26px;
  text-align: center;
}

.join-hero .mini-logo {
  margin: 0 auto 22px;
}

.join-hero h1 {
  margin: 0 0 8px;
  font-size: 38px;
  font-weight: 1000;
  letter-spacing: -0.06em;
}

.join-code {
  display: inline-block;
  margin: 12px 0;
  padding: 8px 14px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--yellow);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 24px;
  font-weight: 1000;
  letter-spacing: 0.16em;
}

.room-heading {
  margin-bottom: 22px;
  text-align: center;
}

.room-heading h1 {
  margin: 4px 0 8px;
  font-size: 34px;
  font-weight: 1000;
  letter-spacing: -0.055em;
}

.room-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.room-code-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
  padding: 16px 17px;
  border: 3px solid var(--ink);
  border-radius: 19px;
  background: var(--yellow);
  box-shadow: 5px 5px 0 var(--ink);
  transform: rotate(-0.6deg);
}

.room-code-label {
  display: block;
  margin-bottom: 2px;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.room-code-value {
  font-size: 28px;
  font-weight: 1000;
  letter-spacing: 0.14em;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 26px 0 12px;
}

.section-title-row h2,
.settings-block h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 950;
  letter-spacing: -0.025em;
}

.count-pill {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-size: 11px;
  font-weight: 900;
}

.player-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.player-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 9px 10px;
  border: 2px solid var(--ink);
  border-radius: 15px;
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--ink);
}

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 2px solid var(--ink);
  border-radius: 11px;
  background: var(--avatar-color, var(--acid));
  font-size: 14px;
  font-weight: 1000;
}

.player-meta {
  min-width: 0;
  flex: 1;
}

.player-name {
  display: block;
  overflow: hidden;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-role {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.online-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #44bf69;
}

.online-dot.offline { background: #aaa2ad; }

.kick-button {
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.kick-button:hover { background: #fff0f2; color: var(--danger); }

.settings-block {
  margin-top: 27px;
  padding: 18px;
  border: 2px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.64);
}

.setting-label {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 17px 2px 8px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.setting-label small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 5px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: #eee7f0;
}

.segmented.two { grid-template-columns: repeat(2, 1fr); }

.segment {
  min-height: 38px;
  padding: 6px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.segment.active {
  border: 2px solid var(--ink);
  background: var(--paper);
  box-shadow: 2px 2px 0 var(--ink);
  color: var(--ink);
}

.segment:disabled { cursor: default; }

.safety-strip {
  display: flex;
  gap: 10px;
  margin: 18px 0;
  padding: 12px 13px;
  border: 1px solid #e6ddcf;
  border-radius: 14px;
  background: #fff7e9;
  color: #665a49;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.4;
}

.safety-strip span { font-size: 17px; }

.waiting {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 52px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--violet);
  box-shadow: 0 0 0 0 rgba(138, 100, 255, 0.45);
  animation: pulse 1.4s infinite;
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(138, 100, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(138, 100, 255, 0); }
}

.game-shell {
  position: relative;
  display: flex;
  min-height: calc(100dvh - max(50px, env(safe-area-inset-top)) - max(36px, env(safe-area-inset-bottom)));
  flex-direction: column;
}

.game-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.game-topbar .topbar-actions { justify-self: end; }

.round-pill {
  padding: 8px 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.connection-banner {
  margin: -6px 0 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #ffe6ea;
  color: #a3293d;
  font-size: 11px;
  font-weight: 850;
  text-align: center;
}

.turn-badge {
  align-self: center;
  margin-bottom: 11px;
  padding: 7px 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--yellow);
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 11px;
  font-weight: 900;
  animation: pop-in 0.3s both;
}

.challenge-wrap {
  display: grid;
  min-height: 370px;
  flex: 1;
  place-items: center;
  padding: 9px 2px 20px;
  perspective: 900px;
}

.challenge-card {
  --card-color: var(--acid);
  position: relative;
  width: 100%;
  min-height: 350px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 23px 23px 20px;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 29px;
  background: var(--paper);
  box-shadow: 8px 9px 0 var(--ink);
  transform: rotate(-0.7deg);
  transform-origin: 50% 100%;
  animation: deal-card 0.48s cubic-bezier(.2, .9, .25, 1.18) both;
}

.challenge-card::before {
  position: absolute;
  top: -70px;
  right: -65px;
  width: 180px;
  height: 180px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--card-color);
  content: "";
}

.challenge-card::after {
  position: absolute;
  right: 15px;
  bottom: 12px;
  width: 75px;
  height: 14px;
  content: "";
  background: repeating-linear-gradient(90deg, var(--ink) 0 3px, transparent 3px 8px);
  opacity: 0.12;
  transform: rotate(-8deg);
}

@keyframes deal-card {
  from { opacity: 0; transform: translateY(50px) rotate(4deg) scale(0.94); }
  to { opacity: 1; transform: translateY(0) rotate(-0.7deg) scale(1); }
}

.challenge-card.color-pink { --card-color: var(--pink); }
.challenge-card.color-violet { --card-color: var(--violet); }
.challenge-card.color-blue { --card-color: var(--blue); }
.challenge-card.color-orange { --card-color: var(--orange); }
.challenge-card.color-yellow { --card-color: var(--yellow); }
.challenge-card.color-lime { --card-color: var(--acid); }

.card-category {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 7px;
  padding: 7px 11px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--card-color);
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-category i {
  font-style: normal;
  font-size: 14px;
}

.challenge-text {
  position: relative;
  z-index: 1;
  margin: 30px 0;
  font-size: clamp(25px, 7.5vw, 36px);
  font-weight: 950;
  letter-spacing: -0.052em;
  line-height: 1.09;
}

.challenge-text mark {
  padding: 0 0.09em;
  background: linear-gradient(transparent 57%, var(--card-color) 57%);
  color: inherit;
}

.card-footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.reaction-area {
  position: relative;
  z-index: 5;
  margin-top: 2px;
}

.reaction-bar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  margin-bottom: 13px;
  padding: 6px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 3px 3px 0 var(--ink);
}

.reaction-button {
  min-width: 0;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 21px;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

.reaction-button:hover { background: #f0e9f3; }
.reaction-button:active { transform: scale(1.3) rotate(-8deg); }

.reaction-stage {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow: hidden;
  pointer-events: none;
}

.floating-reaction {
  --x: 50vw;
  --rotation: 0deg;
  position: absolute;
  left: var(--x);
  bottom: 14vh;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: white;
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 24px;
  animation: float-reaction 2.2s ease-out forwards;
}

.floating-reaction small {
  max-width: 85px;
  overflow: hidden;
  font-size: 10px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes float-reaction {
  0% { opacity: 0; transform: translate(-50%, 30px) scale(0.65) rotate(var(--rotation)); }
  14% { opacity: 1; transform: translate(-50%, 0) scale(1.05) rotate(var(--rotation)); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + 18px), -55vh) scale(1.18) rotate(var(--rotation)); }
}

.host-hint {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 18px;
  background: rgba(23, 18, 31, 0.55);
  backdrop-filter: blur(5px);
  animation: fade-in 0.16s both;
}

.modal {
  width: min(100%, 520px);
  padding: 22px;
  border: 3px solid var(--ink);
  border-radius: 25px;
  background: var(--cream);
  box-shadow: 7px 7px 0 var(--ink);
  animation: slide-up 0.25s cubic-bezier(.2, .8, .3, 1.1) both;
}

.modal-handle {
  width: 42px;
  height: 5px;
  margin: -8px auto 17px;
  border-radius: 99px;
  background: #cfc6d3;
}

.modal h2 {
  margin: 0 0 5px;
  font-size: 24px;
  font-weight: 1000;
  letter-spacing: -0.045em;
}

.modal p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.5;
}

.modal .button + .button { margin-top: 10px; }

.chat-backdrop {
  padding-bottom: max(18px, env(safe-area-inset-bottom));
}

.chat-modal {
  display: flex;
  width: min(100%, 520px);
  height: min(78dvh, 660px);
  max-height: calc(100dvh - max(40px, env(safe-area-inset-top)) - max(20px, env(safe-area-inset-bottom)));
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  background: var(--cream);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 15px;
  border-bottom: 2px solid var(--ink);
  background: var(--acid);
}

.chat-header h2 {
  margin: 1px 0 0;
  font-size: 22px;
}

.chat-kicker {
  display: block;
  font-size: 9px;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.chat-close {
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  background: white;
  font-size: 24px;
  line-height: 1;
}

.chat-list {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 13px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px;
  background:
    radial-gradient(circle at 10% 15%, rgba(138, 100, 255, 0.08), transparent 13rem),
    #f5eff6;
  scrollbar-width: thin;
  scrollbar-color: #bbb0c1 transparent;
}

.chat-empty {
  display: grid;
  min-height: 100%;
  place-content: center;
  justify-items: center;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.chat-empty span {
  margin-bottom: 10px;
  font-size: 38px;
  filter: grayscale(0.15);
}

.chat-empty strong {
  color: var(--ink);
  font-size: 16px;
  font-weight: 950;
}

.chat-empty p {
  max-width: 260px;
  margin: 5px 0 0;
  font-size: 12px;
}

.chat-message {
  display: flex;
  max-width: 86%;
  flex-direction: column;
  align-self: flex-start;
  animation: message-in 0.2s ease-out both;
}

.chat-message.own {
  align-self: flex-end;
}

.chat-message-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 6px 4px;
  color: var(--muted);
  font-size: 9px;
}

.chat-message-head strong {
  overflow: hidden;
  max-width: 170px;
  color: var(--ink-soft);
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-message.own .chat-message-head {
  justify-content: flex-end;
}

.chat-bubble {
  padding: 10px 13px;
  border: 2px solid var(--ink);
  border-radius: 16px 16px 16px 4px;
  background: white;
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.4;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-message.own .chat-bubble {
  border-radius: 16px 16px 4px;
  background: var(--acid);
}

@keyframes message-in {
  from { opacity: 0; transform: translateY(7px) scale(0.98); }
}

.chat-form {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 13px;
  border-top: 2px solid var(--ink);
  background: white;
}

.chat-input {
  width: 100%;
  min-width: 0;
  height: 48px;
  flex: 1;
  padding: 0 14px;
  border: 2px solid var(--ink);
  border-radius: 15px;
  outline: none;
  background: var(--cream);
  color: var(--ink);
  font-size: 16px;
  font-weight: 650;
}

.chat-input:focus {
  background: white;
  box-shadow: 0 0 0 4px rgba(138, 100, 255, 0.2);
}

.chat-send {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 15px;
  background: var(--pink);
  box-shadow: 3px 3px 0 var(--ink);
  color: white;
  font-size: 19px;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.chat-send:active:not(:disabled) {
  box-shadow: 1px 1px 0 var(--ink);
  transform: translate(2px, 2px);
}

.chat-send:disabled {
  cursor: wait;
  opacity: 0.55;
}

@keyframes fade-in { from { opacity: 0; } }
@keyframes slide-up { from { opacity: 0; transform: translateY(40px); } }

.toast-region {
  position: fixed;
  z-index: 200;
  top: max(18px, env(safe-area-inset-top));
  left: 50%;
  width: min(calc(100% - 32px), 460px);
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
  padding: 12px 14px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--ink);
  box-shadow: 4px 4px 0 rgba(202, 255, 61, 0.9);
  color: white;
  font-size: 13px;
  font-weight: 800;
  animation: toast-in 0.22s both;
}

.toast.error { box-shadow: 4px 4px 0 var(--pink); }
.toast.success { box-shadow: 4px 4px 0 var(--acid); }

@keyframes toast-in { from { opacity: 0; transform: translateY(-14px) scale(0.96); } }

.confetti-piece {
  --left: 50vw;
  --delay: 0s;
  --spin: 180deg;
  position: fixed;
  z-index: 150;
  top: -20px;
  left: var(--left);
  width: 10px;
  height: 18px;
  border: 2px solid var(--ink);
  background: var(--confetti, var(--pink));
  pointer-events: none;
  animation: confetti-fall 1.9s var(--delay) cubic-bezier(.15, .7, .35, 1) forwards;
}

@keyframes confetti-fall {
  to { transform: translateY(105vh) rotate(var(--spin)); }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 700px) {
  .app-shell { padding-top: 35px; padding-bottom: 42px; }
  .hero { padding-top: 40px; }
  .panel { padding: 27px; }
  .challenge-card { min-height: 390px; padding: 28px; }
  .challenge-wrap { min-height: 420px; }
  .modal-backdrop { align-items: center; }
}

@media (max-width: 380px) {
  .app-shell { padding-left: 14px; padding-right: 14px; }
  .panel { padding: 18px; }
  .hero h1 { font-size: 49px; }
  .player-list { grid-template-columns: 1fr; }
  .challenge-text { font-size: 25px; }
  .challenge-card { min-height: 325px; padding: 19px; }
  .challenge-wrap { min-height: 345px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
