@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: dark;
  --bg: #050816;
  --surface: #0b1328;
  --surface-2: #111c36;
  --surface-3: #152444;
  --text: #edf6ff;
  --muted: #96a8c4;
  --line: rgba(148, 163, 184, 0.2);
  --primary: #38bdf8;
  --primary-2: #0ea5e9;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
  font-family: Manrope, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background: #050816;
}

button,
input {
  font: inherit;
}

button {
  touch-action: manipulation;
}

.intro-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  height: 100dvh;
  display: grid;
  place-items: center;
  color: #edf6ff;
  background: #050816;
  font-size: clamp(1.6rem, 8vw, 3.35rem);
  font-weight: 900;
  letter-spacing: 0;
  text-align: center;
  animation: intro-in 240ms ease-out both;
}

.intro-screen strong {
  font: inherit;
}

.intro-screen.is-done {
  pointer-events: none;
  animation: intro-out 280ms ease-in both;
}

.intro-screen[hidden] {
  display: none;
}

.top-bar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  height: 74px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: max(12px, env(safe-area-inset-top)) 16px 10px;
  pointer-events: none;
}

.menu-wrap {
  position: relative;
  pointer-events: auto;
}

.menu-button {
  width: 32px;
  height: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.menu-line {
  width: 16px;
  height: 2px;
  display: block;
  border-radius: 999px;
  background: #dbeafe;
}

.menu-button:hover,
.menu-button:focus-visible,
.menu-button[aria-expanded="true"] {
  background: transparent;
}

.menu-button:active {
  transform: scale(0.97);
}

.menu-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 176px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 18, 38, 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  transform-origin: top left;
  animation: menu-pop 170ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.menu-action {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  background: rgba(56, 189, 248, 0.12);
  cursor: pointer;
  font-weight: 800;
  text-align: left;
}

.menu-action + .menu-action {
  margin-top: 6px;
}

.menu-action:hover,
.menu-action:focus-visible {
  background: rgba(56, 189, 248, 0.2);
}

.profile-button {
  width: 52px;
  height: 52px;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(125, 211, 252, 0.6);
  border-radius: 50%;
  background: #12345f;
  box-shadow: 0 10px 28px rgba(2, 132, 199, 0.24);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.profile-button:hover,
.profile-button:focus-visible {
  border-color: rgba(186, 230, 253, 0.95);
  box-shadow: 0 14px 34px rgba(14, 165, 233, 0.36);
}

.profile-button:active {
  transform: scale(0.97);
}

.profile-button img,
.profile-photo-large,
.profile-banner {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.app-shell {
  width: min(100%, 860px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 90px 18px 22px;
}

.blank-stage {
  min-height: calc(100dvh - 112px);
}

.welcome-stage {
  min-height: 100dvh;
  margin: -90px -18px -22px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.welcome-hero {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  text-align: center;
}

.welcome-hero h1 {
  width: min(100%, 760px);
  margin: 0 auto;
  font-size: clamp(2.35rem, 8vw, 5.9rem);
  line-height: 0.96;
  font-weight: 900;
}

.welcome-hero span {
  color: #7dd3fc;
}

.reveal-section {
  min-height: 74vh;
  padding: 36px 18px 92px;
  opacity: 0;
  transform: translateY(24px);
}

.reveal-section.is-visible {
  animation: reveal-up 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.reveal-section h2 {
  margin: 0 0 24px;
  font-size: clamp(2rem, 7vw, 4.8rem);
  line-height: 0.98;
}

.game-showcase {
  display: grid;
  gap: 6px;
}

.game-demo {
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  transition:
    min-height 720ms cubic-bezier(0.16, 1, 0.3, 1),
    padding 720ms cubic-bezier(0.16, 1, 0.3, 1),
    border-color 520ms ease;
}

.game-demo.is-opening {
  min-height: 78px;
}

.game-demo.is-expanded {
  min-height: min(76vh, 620px);
  padding-bottom: 28px;
  border-color: rgba(125, 211, 252, 0.34);
  animation: game-expand 720ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.game-demo.is-expanding .game-row span {
  font-size: clamp(1.3rem, 5vw, 2.45rem);
}

.game-row {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.game-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.06rem;
  font-weight: 900;
}

.game-row strong {
  color: #7dd3fc;
  font-size: 0.86rem;
}

.fake-chat {
  width: min(100%, 680px);
  max-height: 0;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  opacity: 0;
  transform: translateY(-6px);
  transition:
    max-height 720ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 520ms ease,
    transform 720ms cubic-bezier(0.16, 1, 0.3, 1),
    padding 720ms cubic-bezier(0.16, 1, 0.3, 1);
}

.game-demo.is-expanded .fake-chat {
  max-height: 620px;
  min-height: 390px;
  padding: 18px 0 0;
  opacity: 1;
  transform: translateY(0);
  animation: chat-message-in 420ms ease-out both;
}

.chat-shell {
  display: grid;
  gap: 10px;
}

.telegram-chat {
  width: min(100%, 520px);
  min-height: 360px;
  padding: 14px 10px 16px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(22, 77, 99, 0.46), rgba(13, 42, 65, 0.88)),
    #0a2236;
  box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.1);
}

.telegram-date-pill {
  justify-self: center;
  padding: 4px 10px;
  border-radius: 999px;
  color: rgba(224, 242, 254, 0.9);
  background: rgba(15, 23, 42, 0.36);
  font-size: 0.68rem;
  font-weight: 800;
}

.telegram-message-row {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  animation: chat-message-in 320ms ease-out both;
}

.telegram-message-row[hidden],
.bot-response[hidden],
.demo-preview[hidden] {
  display: none;
}

.telegram-message-row-user {
  justify-content: flex-end;
}

.chat-line {
  margin-left: auto;
}

.telegram-avatar {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #042033;
  background: #7dd3fc;
  font-size: 0.58rem;
  font-weight: 900;
}

.telegram-bubble {
  position: relative;
  width: fit-content;
  max-width: min(78vw, 386px);
  padding: 8px 10px 16px;
  border-radius: 8px;
  color: #eff6ff;
  font-size: 0.88rem;
  line-height: 1.35;
}

.telegram-bubble time {
  position: absolute;
  right: 8px;
  bottom: 3px;
  color: rgba(226, 232, 240, 0.66);
  font-size: 0.58rem;
  font-weight: 700;
}

.telegram-bubble-user {
  border-bottom-right-radius: 3px;
  background: #2b8aeb;
}

.telegram-bubble-bot {
  border-bottom-left-radius: 3px;
  background: #17212b;
}

.bot-response {
  animation: bot-reply-in 380ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.telegram-setup {
  animation: bot-reply-in 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.setup-keyboard {
  animation: board-pop 360ms cubic-bezier(0.2, 0.8, 0.2, 1) 130ms both;
}

.setup-keyboard.is-choice-made .telegram-key:not(.setup-selected) {
  opacity: 0.46;
}

.setup-selected {
  color: #02131f;
  background: #7dd3fc;
  box-shadow: inset 0 0 0 1px rgba(224, 242, 254, 0.38);
}

.bot-response strong,
.message-preview strong {
  display: block;
  margin-bottom: 3px;
  color: #7dd3fc;
  font-size: 0.78rem;
  font-weight: 900;
}

.typing-command::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 1em;
  margin-left: 2px;
  background: currentColor;
  vertical-align: -2px;
  animation: caret-blink 700ms steps(2, start) infinite;
}

.command-deleting {
  animation: command-delete 260ms ease-in both;
}

.demo-preview {
  animation: board-pop 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.demo-preview p {
  margin: 8px 0 0;
  color: #cbd5e1;
  font-size: 0.78rem;
}

.chat-preview-note {
  display: block;
  color: #7dd3fc;
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.message-preview {
  width: min(100%, 430px);
  padding: 10px 10px 12px;
  animation: board-pop 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.bot-message-preview pre {
  margin: 8px 0 0;
  white-space: pre-wrap;
  color: #e0f2fe;
  font: 800 1rem/1.45 Manrope, ui-sans-serif, system-ui, sans-serif;
}

.telegram-inline-keyboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin-top: 10px;
}

.telegram-key {
  min-height: 30px;
  display: grid;
  place-items: center;
  padding: 0 10px;
  border-radius: 6px;
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.11);
  font-size: 0.75rem;
  font-weight: 900;
}

.view-stage {
  animation: view-in 210ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.view-stage[hidden] {
  display: none;
}

.view-stage.is-entering {
  animation: view-in 210ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.view-stage.is-exiting {
  animation: view-out 160ms cubic-bezier(0.4, 0, 1, 1);
}

.games-stage {
  min-height: 100dvh;
  margin: -90px -18px -22px;
  padding: 92px 18px 28px;
  background:
    linear-gradient(180deg, rgba(6, 182, 212, 0.16), rgba(5, 8, 22, 0) 34%),
    #050816;
}

.games-stage[hidden] {
  display: none;
}

.games-stage h1 {
  margin: 0;
  color: #eff6ff;
  font-size: clamp(2rem, 7vw, 4rem);
  line-height: 0.98;
  font-weight: 900;
}

.games-layout {
  width: min(100%, 760px);
  margin: 0 auto;
}

.games-header {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.game-score-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.game-score-strip span {
  min-width: 116px;
  padding: 10px 12px;
  border: 1px solid rgba(125, 211, 252, 0.18);
  border-radius: 8px;
  color: #bfdbfe;
  background: rgba(8, 20, 39, 0.72);
  font-size: 0.86rem;
  font-weight: 800;
}

.game-score-strip strong {
  color: #fff;
  font-size: 1.1rem;
}

.games-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.games-list[hidden] {
  display: none;
}

.game-launch-card {
  min-height: 104px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(125, 211, 252, 0.2);
  border-radius: 8px;
  color: var(--text);
  background: rgba(9, 18, 38, 0.9);
  cursor: pointer;
  text-align: left;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.game-launch-card:hover,
.game-launch-card:focus-visible {
  border-color: rgba(125, 211, 252, 0.64);
  background: rgba(15, 35, 65, 0.96);
  transform: translateY(-2px);
}

.game-launch-card:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.game-launch-card span,
.game-launch-card strong,
.game-launch-card small,
.game-launch-card b {
  min-width: 0;
}

.game-launch-card span {
  display: grid;
  gap: 5px;
  align-content: start;
}

.game-launch-card strong {
  color: #eff6ff;
  font-size: 1rem;
  font-weight: 900;
}

.game-launch-card small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.game-launch-card b {
  align-self: end;
  color: #7dd3fc;
  font-size: 0.78rem;
}

.game-launch-card.is-ready {
  background:
    linear-gradient(135deg, rgba(255, 73, 134, 0.18), rgba(60, 255, 174, 0.12)),
    rgba(9, 18, 38, 0.94);
}

.game-window {
  display: grid;
  gap: 14px;
  animation: view-in 210ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.game-window[hidden] {
  display: none;
}

.game-window-header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.game-window-header h2 {
  margin: 0;
  overflow: hidden;
  color: #eff6ff;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.2rem;
  font-weight: 900;
}

.game-back-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(125, 211, 252, 0.22);
  border-radius: 8px;
  color: #eff6ff;
  background: rgba(9, 18, 38, 0.92);
  cursor: pointer;
  font-size: 1.7rem;
  font-weight: 900;
}

.game-panel[hidden] {
  display: none;
}

.block-blast-panel {
  display: grid;
  gap: 14px;
}

.block-blast-panel[hidden] {
  display: none;
}

.block-toolbar {
  display: flex;
  justify-content: flex-end;
}

.block-board {
  width: min(100%, 520px);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 5px;
  padding: 8px;
  border: 1px solid rgba(125, 211, 252, 0.18);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.82);
}

.block-cell {
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.88);
  cursor: pointer;
}

.block-cell.is-filled {
  border-color: rgba(255, 255, 255, 0.32);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0)),
    var(--block-color);
  box-shadow: inset 0 -4px 10px rgba(0, 0, 0, 0.24);
}

.block-cell.is-preview-valid {
  border-color: rgba(60, 255, 174, 0.72);
  background:
    linear-gradient(135deg, rgba(60, 255, 174, 0.34), rgba(60, 255, 174, 0.08)),
    rgba(15, 23, 42, 0.92);
  animation: block-preview-pulse 620ms ease-in-out infinite;
}

.block-cell.is-preview-invalid {
  border-color: rgba(255, 73, 134, 0.8);
  background:
    linear-gradient(135deg, rgba(255, 73, 134, 0.4), rgba(255, 73, 134, 0.1)),
    rgba(15, 23, 42, 0.92);
}

.block-cell.is-rejected {
  animation: reject-cell 220ms ease both;
}

.block-cell.is-clearing {
  animation: block-explode 260ms ease-out both;
}

.block-pieces {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  gap: 14px;
}

.block-piece {
  color: #e0f2fe;
  cursor: pointer;
  touch-action: none;
}

.block-piece-figure {
  justify-self: center;
  width: 92px;
  height: 92px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 4px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.block-piece-figure:active {
  cursor: grabbing;
}

.block-piece-figure[data-selected="true"] {
  filter: drop-shadow(0 0 12px rgba(125, 211, 252, 0.72));
  transform: scale(1.04);
}

.block-drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  opacity: 0.9;
  pointer-events: none;
  touch-action: none;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.34));
  will-change: transform;
}

.piece-cell {
  grid-row: var(--piece-row);
  grid-column: var(--piece-col);
  border-radius: 4px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0)),
    var(--piece-color);
  box-shadow: inset 0 -3px 7px rgba(0, 0, 0, 0.22);
}

.match-three-panel {
  display: grid;
  gap: 14px;
}

.match-toolbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) 44px;
  align-items: center;
  gap: 8px;
}

.match-toolbar span {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(125, 211, 252, 0.18);
  border-radius: 8px;
  color: #bfdbfe;
  background: rgba(8, 20, 39, 0.72);
  font-size: 0.84rem;
  font-weight: 800;
}

.match-toolbar strong {
  color: #fff;
}

.match-board {
  width: min(100%, 520px);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(125, 211, 252, 0.18);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.82);
}

.match-tile {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0) 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0)),
    var(--match-color);
  box-shadow: inset 0 -6px 12px rgba(0, 0, 0, 0.24);
  cursor: pointer;
  touch-action: none;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.match-tile::before {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: 30% 70% 45% 55%;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.04)),
    rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 -6px 10px rgba(0, 0, 0, 0.12);
  transform: rotate(16deg);
}

.match-tile:hover,
.match-tile:focus-visible,
.match-tile.is-selected {
  transform: translateY(-2px) scale(1.03);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.16),
    inset 0 -6px 12px rgba(0, 0, 0, 0.24);
}

.match-tile.is-sliding {
  animation: match-swap-pop 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.match-tile.is-clearing {
  animation: block-explode 240ms ease-out both;
}

.leaderboard-panel {
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.panel-header,
.panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-header {
  padding: 10px 0 14px;
  background: transparent;
}

.leaderboard-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.leaderboard-filter select {
  min-height: 38px;
  border: 1px solid rgba(191, 219, 254, 0.25);
  border-radius: 8px;
  color: #eff6ff;
  background: rgba(15, 23, 42, 0.92);
  font-weight: 800;
}

.leaderboard-filter option {
  color: #0f172a;
}

.eyebrow {
  margin: 0 0 6px;
  color: rgba(219, 234, 254, 0.62);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 1.2rem + 1.4vw, 2.35rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.status-pill {
  flex: 0 0 auto;
  min-width: 82px;
  padding: 8px 10px;
  border: 1px solid rgba(191, 219, 254, 0.25);
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
}

.leaderboard-list {
  min-height: 320px;
  margin: 0;
  padding: 8px 0;
  list-style: none;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 48px 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.rank {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #031225;
  background: var(--primary);
  font-size: 0.85rem;
  font-weight: 800;
}

.username {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #dbeafe;
  font-size: 1rem;
  font-weight: 800;
}

.leaderboard-avatar {
  width: 44px;
  height: 44px;
  overflow: hidden;
  border: 1px solid rgba(125, 211, 252, 0.28);
  border-radius: 50%;
  background: #0b3f56;
}

.leaderboard-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.leaderboard-user {
  min-width: 0;
}

.display-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1rem;
  font-weight: 900;
}

.leaderboard-user .username {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.score {
  min-width: 78px;
  color: #bfdbfe;
  font-size: 1.08rem;
  font-weight: 900;
  text-align: right;
}

.empty-state {
  padding: 64px 20px;
  color: var(--muted);
  text-align: center;
}

.panel-footer {
  padding: 14px 0;
  border-top: 0;
  color: var(--muted);
  background: transparent;
  font-size: 0.82rem;
}

.icon-button,
.close-button {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(15, 23, 42, 0.9);
  cursor: pointer;
}

.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 8px;
}

.profile-modal {
  position: fixed;
  inset: 82px 0 auto 0;
  width: min(calc(100% - 24px), 430px);
  max-height: min(calc(100dvh - 104px), 560px);
  margin: 0 auto;
  padding: 0;
  border: 1px solid rgba(125, 211, 252, 0.18);
  border-radius: 8px;
  color: var(--text);
  background: transparent;
  box-shadow: var(--shadow);
}

.profile-modal[open] {
  display: flex;
  align-items: start;
}

.profile-modal::backdrop {
  background: rgba(1, 6, 19, 0.64);
  backdrop-filter: blur(10px);
}

.profile-card {
  position: relative;
  width: 100%;
  max-height: min(calc(100dvh - 104px), 560px);
  overflow: hidden;
  padding: 8px 10px 12px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(17, 29, 58, 0.96), rgba(7, 16, 36, 0.99)),
    var(--surface);
}

.close-button {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 4;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.15rem;
  line-height: 1;
}

.account-banner {
  position: relative;
  height: 76px;
  overflow: hidden;
  border: 1px solid rgba(125, 211, 252, 0.12);
  border-radius: 8px;
  background: #102144;
}

.profile-banner {
  background:
    linear-gradient(90deg, rgba(14, 165, 233, 0.28), transparent),
    #102144;
}

.profile-head {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-top: -24px;
  padding: 0 8px;
}

.profile-photo-wrap {
  position: relative;
  flex: 0 0 auto;
  width: 68px;
  height: 68px;
}

.profile-photo-large {
  border: 3px solid #0b1328;
  border-radius: 50%;
  background: #0ea5e9;
}

.profile-copy {
  min-width: 0;
  padding-bottom: 7px;
}

.profile-copy h2 {
  margin-bottom: 2px;
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0;
}

.username-line {
  margin-bottom: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
}

.image-upload {
  width: 42px;
  height: 42px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  color: #e0f2fe;
  background: transparent;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease;
}

.image-upload:hover,
.image-upload:focus-within {
  background: rgba(15, 23, 42, 0.28);
}

.image-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.banner-upload {
  position: absolute;
  right: 10px;
  bottom: 10px;
}

.photo-upload {
  position: absolute;
  inset: auto -7px -4px auto;
  width: 34px;
  height: 34px;
  min-height: 34px;
  border: 0;
}

.pen-icon {
  width: 15px;
  height: 15px;
  display: block;
  background: currentColor;
  clip-path: polygon(70% 0, 100% 30%, 36% 94%, 4% 100%, 10% 68%);
}

.upload-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 8px 0;
  color: rgba(203, 213, 225, 0.72);
  font-size: 0.74rem;
}

.upload-hints span {
  padding: 5px 8px;
  border: 1px solid rgba(125, 211, 252, 0.1);
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.28);
}

.profile-copy h2[contenteditable="true"] {
  min-width: 160px;
  border-radius: 8px;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.76);
}

.rewards-section {
  margin: 14px 8px 0;
}

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

.section-title-row h3 {
  margin-bottom: 0;
  font-size: 0.95rem;
}

.section-title-row span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.rewards-blur-panel {
  position: relative;
  height: 168px;
  overflow: hidden;
  border: 1px solid rgba(125, 211, 252, 0.1);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.72);
}

.rewards-blur-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(0, 5, 18, 0.76);
  backdrop-filter: blur(13px) brightness(0.46);
  -webkit-backdrop-filter: blur(13px) brightness(0.46);
}

.reward-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
}

.reward-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(125, 211, 252, 0.12);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.42);
}

.reward-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: cover;
  object-position: center;
}

.reward-card strong,
.reward-card span {
  display: block;
  padding: 0 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reward-card strong {
  padding-top: 8px;
  color: #dbeafe;
  font-size: 0.76rem;
}

.reward-card span {
  padding-bottom: 9px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
}

.rewards-lock {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  color: #e0f2fe;
  font-size: 1rem;
  font-weight: 900;
  text-transform: uppercase;
}

@media (max-width: 520px) {
  .top-bar {
    height: 70px;
    padding-inline: 14px;
  }

  .menu-button {
    width: 32px;
    height: 32px;
  }

  .profile-button {
    width: 48px;
    height: 48px;
  }

  .menu-popover {
    min-width: 164px;
  }

  .app-shell {
    padding: 82px 12px 14px;
  }

  .blank-stage {
    min-height: calc(100dvh - 96px);
  }

  .welcome-hero {
    min-height: 100dvh;
  }

  .game-row {
    min-height: 54px;
  }

  .games-stage {
    margin: -82px -12px -14px;
    padding: 84px 12px 20px;
  }

  .games-list,
  .block-pieces {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .game-launch-card {
    min-height: 86px;
  }

  .block-piece-figure {
    width: 82px;
    height: 82px;
  }

  .match-toolbar {
    grid-template-columns: 1fr 1fr 44px;
  }

  .panel-header {
    align-items: flex-start;
  }

  .welcome-stage {
    margin: -82px -12px -14px;
  }

  .leaderboard-row {
    grid-template-columns: 36px 42px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
  }

  .rank {
    width: 30px;
    height: 30px;
  }

  .leaderboard-avatar {
    width: 40px;
    height: 40px;
  }

  .score {
    grid-column: 3;
    justify-self: start;
    min-width: 0;
    text-align: left;
  }

  .profile-modal {
    inset: 74px 0 auto 0;
    width: calc(100% - 18px);
    max-height: min(calc(100dvh - 88px), 560px);
  }

  .profile-card {
    max-height: min(calc(100dvh - 88px), 560px);
  }

  .reward-grid {
    grid-template-columns: 1fr 1fr;
  }
}

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

@keyframes intro-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes intro-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes reveal-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes chat-message-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes game-expand {
  from {
    opacity: 0.86;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes bot-reply-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes board-pop {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes command-delete {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(12px) scale(0.98);
  }
}

@keyframes reject-cell {
  40% {
    border-color: rgba(255, 73, 134, 0.9);
    transform: scale(0.92);
  }
}

@keyframes block-preview-pulse {
  50% {
    filter: brightness(1.45);
    transform: scale(0.94);
  }
}

@keyframes block-explode {
  0% {
    opacity: 1;
    transform: scale(1);
    filter: brightness(1);
  }
  55% {
    opacity: 1;
    transform: scale(1.22) rotate(5deg);
    filter: brightness(1.85);
  }
  100% {
    opacity: 0;
    transform: scale(0.25) rotate(-12deg);
    filter: brightness(2.2);
  }
}

@keyframes match-swap-pop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.12) rotate(3deg);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes caret-blink {
  50% {
    opacity: 0;
  }
}

@keyframes menu-pop {
  from {
    opacity: 0;
    transform: translateY(-5px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes view-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}
