:root {
  color-scheme: light dark;
  --bg: #0f1014;
  --panel: #171a21;
  --panel-soft: #1f2430;
  --text: #f2f4f8;
  --muted: #9aa3b2;
  --accent: #8f7cff;
  --accent-2: #2dd4bf;
  --danger: #ff6b6b;
  --border: #262b36;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  --game-bg: #1f2430;
  --game-cell: rgba(255, 255, 255, 0.06);
  --game-tile-rgb: 143, 124, 255;
  --game-tile-shadow: 0 12px 22px rgba(0, 0, 0, 0.18);
  --game-overlay: rgba(10, 12, 16, 0.6);
}

body[data-theme="light"] {
  --bg: #f4f5f9;
  --panel: #ffffff;
  --panel-soft: #eef1f7;
  --text: #1f2430;
  --muted: #5f6c7b;
  --accent: #635bff;
  --accent-2: #0ea5e9;
  --danger: #ff4d6d;
  --border: #dde1ea;
  --shadow: 0 12px 30px rgba(17, 24, 39, 0.12);
  --game-bg: #f0f3fb;
  --game-cell: rgba(31, 36, 48, 0.08);
  --game-tile-rgb: 99, 91, 255;
  --game-tile-shadow: 0 10px 20px rgba(17, 24, 39, 0.12);
  --game-overlay: rgba(255, 255, 255, 0.65);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Inter", "Segoe UI", sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 64px;
  height: 64px;
  border-radius: 0;
  background: transparent;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 0;
}

.brand-name {
  font-weight: 700;
  font-size: 18px;
}

.brand-tag {
  font-size: 12px;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
  transition: color 0.2s ease;
}

.brand-tag:hover {
  color: var(--text);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: grab;
  transition: 0.2s ease;
}

.nav-item.active {
  background: var(--panel-soft);
  border-color: var(--border);
}

.nav-item:hover {
  background: rgba(143, 124, 255, 0.12);
}

.nav-item:focus,
.nav-item:focus-visible {
  outline: none;
  box-shadow: none;
}

.nav-item .icon {
  flex-shrink: 0;
}

.nav-item.active .icon {
  background-color: var(--accent);
}

.nav-item:hover .icon {
  background-color: var(--accent-2);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  justify-content: center;
  padding: 12px 8px 6px;
  color: var(--text);
  opacity: 0.65;
  font-size: 12px;
  letter-spacing: 0.2px;
}

.project-timer {
  color: var(--muted);
  opacity: 0.9;
  font-size: 11px;
  text-align: center;
}

.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 26px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 10;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--panel-soft);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.search input {
  border: none;
  background: transparent;
  color: var(--text);
  outline: none;
  width: 220px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chip {
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
}

.mini-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: var(--panel-soft);
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 13px;
}

.mini-profile img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.view {
  display: none;
  padding: 28px;
  animation: fadeIn 0.3s ease;
}

.view.active {
  display: block;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.badge {
  background: rgba(143, 124, 255, 0.18);
  color: var(--accent);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel h3 {
  margin-bottom: 12px;
}

.panel label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--muted);
}

.panel input,
.panel textarea {
  border: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
}

.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
}

.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 14px;
  cursor: pointer;
}

.auth-card {
  background: var(--panel);
  border-radius: 20px;
  padding: 32px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.auth-header {
  margin-bottom: 20px;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.composer {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 20px;
}

.composer textarea {
  width: 100%;
  border: none;
  background: transparent;
  resize: none;
  color: var(--text);
  outline: none;
  overflow: hidden;
  min-height: 44px;
  transition: height 0.2s ease;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-direction: row-reverse;
}
.attach-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text);
}

.attach-preview img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
}

.attach-preview .file-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(143, 124, 255, 0.2);
  font-weight: 700;
}

.post-attachment {
  margin-top: 12px;
  padding: 10px;
  border-radius: 14px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
}

.post-attachment img,
.post-attachment video {
  width: 100%;
  border-radius: 12px;
  display: block;
  max-height: 320px;
  object-fit: cover;
}

.post-attachment .file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.post-attachment .file-row .file-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(143, 124, 255, 0.2);
  font-weight: 700;
}

.hidden {
  display: none;
}

.attach-menu {
  position: relative;
}

.attach-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  transform: translateY(0);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 170px;
  z-index: 20;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.attach-dropdown button {
  border: none;
  background: transparent;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
}

.attach-dropdown button:hover {
  background: var(--panel-soft);
}

.attach-menu:hover .attach-dropdown,
.attach-dropdown:hover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.attach-menu::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 8px;
}

.hint {
  color: var(--muted);
  font-size: 12px;
}

.feed-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.post.animate-in,
.comment.animate-in {
  animation: itemIn 0.24s ease;
}

.post.animate-out,
.comment.animate-out {
  animation: itemOut 0.22s ease forwards;
}

.post {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.post-author {
  display: flex;
  align-items: center;
  gap: 10px;
}

.post-author img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
}

.post-content {
  line-height: 1.5;
  margin-bottom: 12px;
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.post-actions button {
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.post-actions button.liked {
  color: var(--accent);
}

.comments {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.comment {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.comment img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
}

.comment-box {
  background: var(--panel-soft);
  padding: 8px 12px;
  border-radius: 12px;
  width: 100%;
}

.comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.ghost.tiny {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 10px;
}

.comment-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.comment-form input {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  border-radius: 12px;
  padding: 8px 12px;
  color: var(--text);
}

.profile-card {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
}

.profile-avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.profile-avatar img {
  width: 140px;
  height: 140px;
  border-radius: 30px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.upload input {
  display: none;
}

.upload span {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 12px;
  cursor: pointer;
}

.friends-grid,
.games-grid,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.friends-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.friend-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 14px;
  background: var(--panel-soft);
}

.friend-card img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.chat-card {
  background: var(--panel);
  border-radius: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 70vh;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-small {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  font-weight: 600;
}

.chat-status {
  color: var(--accent-2);
  font-size: 12px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--panel-soft);
}

.chat-bubble.me {
  align-self: flex-end;
  background: rgba(143, 124, 255, 0.2);
}

.chat-input {
  display: flex;
  gap: 10px;
}

.chat-input input {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
}

.game-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.game-score {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.game-score strong {
  color: var(--text);
  font-size: 16px;
}

.score-divider {
  opacity: 0.4;
}

.game-2048 {
  background: var(--game-bg);
  padding: 12px;
  border-radius: 16px;
  width: 100%;
  height: auto;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(143, 124, 255, 0.2);
  max-width: 100%;
}

.board-grid,
.board-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--tile-gap, 8px);
}

.board-grid {
  justify-content: start;
}

.board-grid {
  opacity: 0.35;
  justify-content: center;
}

.board-tiles {
  position: absolute;
  inset: 12px;
  pointer-events: none;
}

.board-tiles .tile {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
}

.board-grid .cell {
  background: var(--game-cell);
  border-radius: 14px;
  width: var(--tile-size, 78px);
  height: var(--tile-size, 78px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.tile {
  background: rgba(var(--game-tile-rgb), var(--tile-alpha, 0.22));
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 24px;
  color: var(--text);
  width: var(--tile-size, 78px);
  height: var(--tile-size, 78px);
  transform: translate(var(--x, 0px), var(--y, 0px)) scale(1);
  transition: transform 0.16s ease, box-shadow 0.2s ease;
  box-shadow: var(--game-tile-shadow);
}

.tile.tile-new {
  animation: tilePop 0.18s ease;
}

.tile.tile-merge {
  animation: tileMerge 0.2s ease;
}

.game-overlay {
  position: absolute;
  inset: 12px;
  background: var(--game-overlay);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.game-overlay.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.game-overlay-card {
  background: rgba(23, 26, 33, 0.92);
  border: 1px solid rgba(143, 124, 255, 0.35);
  border-radius: 18px;
  padding: 22px;
  display: grid;
  gap: 12px;
  text-align: center;
  min-width: 220px;
}

.game-overlay-title {
  font-size: 18px;
  font-weight: 700;
}

.game-overlay-sub {
  color: var(--muted);
  font-size: 13px;
}

.game-overlay-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.toasts {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
}

.toast {
  background: linear-gradient(135deg, rgba(23, 26, 33, 0.95), rgba(31, 36, 48, 0.95));
  border: 1px solid rgba(143, 124, 255, 0.3);
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  min-width: 240px;
  animation: toastIn 0.32s ease;
  backdrop-filter: blur(12px);
  display: grid;
  gap: 8px;
}

.toast.fade-out {
  animation: toastOut 0.28s ease forwards;
}

.toast.success {
  border-color: rgba(45, 212, 191, 0.45);
}

.toast.info {
  border-color: rgba(143, 124, 255, 0.4);
}

.toast-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-icon {
  width: 26px;
  height: 26px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(143, 124, 255, 0.2);
}

.toast-message {
  font-size: 13px;
  color: var(--text);
}

.toast-progress {
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  animation: toastProgress 3.2s linear forwards;
}

.toast.error {
  border-color: rgba(255, 107, 107, 0.45);
}

.toast.error .toast-icon {
  background: rgba(255, 107, 107, 0.25);
}

.toast.success {
  border-color: rgba(45, 212, 191, 0.45);
}

.toast.success .toast-icon {
  background: rgba(45, 212, 191, 0.25);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 10, 0.6);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: rgba(23, 26, 33, 0.95);
  border: 1px solid rgba(143, 124, 255, 0.35);
  border-radius: 18px;
  padding: 22px;
  min-width: 280px;
  display: grid;
  gap: 10px;
  box-shadow: var(--shadow);
  animation: modalPop 0.18s ease;
}

.avatar-modal {
  min-width: 320px;
}

.avatar-crop {
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
}

#avatarCanvas {
  width: 256px;
  height: 256px;
  border-radius: 18px;
  background: #111;
  cursor: grab;
}

.avatar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-controls label {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  color: var(--muted);
  font-size: 13px;
}

.avatar-controls input[type="range"] {
  width: 100%;
}

.modal-title {
  font-weight: 700;
  font-size: 18px;
}

.modal-sub {
  color: var(--muted);
  font-size: 13px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.changelog-page {
  min-height: 100vh;
  padding: 40px 24px;
  background: var(--bg);
  color: var(--text);
  display: flex;
  justify-content: center;
}

.changelog-card {
  width: min(760px, 100%);
}

.changelog-entry {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.changelog-entry ul {
  margin: 0;
  padding-left: 18px;
}

@media (max-width: 1200px) {
  .app-shell {
    grid-template-columns: 220px 1fr;
  }
  .main .view {
    padding: 22px;
  }
  .topbar {
    padding: 14px 18px;
  }
  .search input {
    width: 180px;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 200px 1fr;
  }
  .brand-logo {
    width: 56px;
    height: 56px;
  }
  .brand-name {
    font-size: 16px;
  }
  .nav-item {
    padding: 10px 12px;
  }
  .composer-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .composer-actions {
    width: 100%;
    flex-direction: row;
    justify-content: flex-end;
  }
  .friends-grid {
    grid-template-columns: 1fr;
  }
  .games-grid {
    grid-template-columns: 1fr;
  }
  .chat-card {
    padding: 16px;
  }
}

@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 12;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .brand {
    gap: 10px;
  }
  .brand-logo {
    width: 44px;
    height: 44px;
  }
  .nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
  }
  .nav-item {
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
  }
  .nav-item span:not(.icon) {
    display: none;
  }
  .sidebar-footer {
    display: none;
  }
  .main {
    min-height: auto;
  }
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .topbar-left,
  .topbar-right {
    justify-content: space-between;
    width: 100%;
  }
  .search {
    width: 100%;
  }
  .search input {
    width: 100%;
  }
  .mini-profile {
    display: none;
  }
  .view {
    padding: 18px;
  }
  .profile-card {
    grid-template-columns: 1fr;
  }
  .composer-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
  .post-actions {
    flex-wrap: wrap;
    gap: 10px;
  }
  .comment-form {
    flex-direction: column;
    align-items: stretch;
  }
  .comment-form input {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .sidebar {
    align-items: flex-start;
  }
  .nav {
    width: 100%;
    justify-content: flex-start;
  }
  .topbar-right {
    flex-wrap: wrap;
    gap: 8px;
  }
  .chip {
    padding: 6px 10px;
  }
  .auth-card {
    padding: 22px;
  }
  .composer {
    padding: 12px;
  }
  .panel {
    padding: 16px;
  }
  .game-score {
    flex-wrap: wrap;
    gap: 6px;
  }
  .game-2048 {
    width: 100%;
  }
}

.icon {
  width: 20px;
  height: 20px;
  display: inline-block;
  background-color: var(--text);
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.icon-feed {
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M3 11l9-8 9 8v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z'/></svg>");
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M3 11l9-8 9 8v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z'/></svg>");
}
.icon-profile {
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12 12a4 4 0 1 0-4-4 4 4 0 0 0 4 4zm0 2c-4.42 0-8 2-8 4.5V21h16v-2.5c0-2.5-3.58-4.5-8-4.5z'/></svg>");
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12 12a4 4 0 1 0-4-4 4 4 0 0 0 4 4zm0 2c-4.42 0-8 2-8 4.5V21h16v-2.5c0-2.5-3.58-4.5-8-4.5z'/></svg>");
}
.icon-friends {
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M16 11a4 4 0 1 0-4-4 4 4 0 0 0 4 4zm-8 0a3 3 0 1 0-3-3 3 3 0 0 0 3 3zm0 2c-3.31 0-6 1.79-6 4v2h6.5c0-2.21 2.69-4 6-4a9.64 9.64 0 0 1 3.21.53A6.51 6.51 0 0 0 8 13zm8 0c-2.67 0-5 1.34-5 3v3h10v-3c0-1.66-2.33-3-5-3z'/></svg>");
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M16 11a4 4 0 1 0-4-4 4 4 0 0 0 4 4zm-8 0a3 3 0 1 0-3-3 3 3 0 0 0 3 3zm0 2c-3.31 0-6 1.79-6 4v2h6.5c0-2.21 2.69-4 6-4a9.64 9.64 0 0 1 3.21.53A6.51 6.51 0 0 0 8 13zm8 0c-2.67 0-5 1.34-5 3v3h10v-3c0-1.66-2.33-3-5-3z'/></svg>");
}
.icon-messages {
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M4 4h16a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H8l-4 3v-3H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z'/></svg>");
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M4 4h16a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H8l-4 3v-3H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z'/></svg>");
}
.icon-games {
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M6 8h12a4 4 0 0 1 4 4v2a4 4 0 0 1-4 4h-3l-3 3-3-3H6a4 4 0 0 1-4-4v-2a4 4 0 0 1 4-4zm2.5 3H7v1.5H5.5V14H7v1.5h1.5V14H10v-1.5H8.5zm7 0a1.5 1.5 0 1 0 1.5 1.5A1.5 1.5 0 0 0 15.5 11zm3 2a1.5 1.5 0 1 0 1.5 1.5A1.5 1.5 0 0 0 18.5 13z'/></svg>");
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M6 8h12a4 4 0 0 1 4 4v2a4 4 0 0 1-4 4h-3l-3 3-3-3H6a4 4 0 0 1-4-4v-2a4 4 0 0 1 4-4zm2.5 3H7v1.5H5.5V14H7v1.5h1.5V14H10v-1.5H8.5zm7 0a1.5 1.5 0 1 0 1.5 1.5A1.5 1.5 0 0 0 15.5 11zm3 2a1.5 1.5 0 1 0 1.5 1.5A1.5 1.5 0 0 0 18.5 13z'/></svg>");
}
.icon-settings {
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12 8a4 4 0 1 0 4 4 4 4 0 0 0-4-4zm9 4a7.47 7.47 0 0 0-.12-1.34l2.1-1.64-2-3.46-2.5 1a7.73 7.73 0 0 0-2.32-1.34l-.38-2.65H9.22l-.38 2.65a7.73 7.73 0 0 0-2.32 1.34l-2.5-1-2 3.46 2.1 1.64A7.47 7.47 0 0 0 3 12a7.47 7.47 0 0 0 .12 1.34l-2.1 1.64 2 3.46 2.5-1a7.73 7.73 0 0 0 2.32 1.34l.38 2.65h5.56l.38-2.65a7.73 7.73 0 0 0 2.32-1.34l2.5 1 2-3.46-2.1-1.64A7.47 7.47 0 0 0 21 12z'/></svg>");
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12 8a4 4 0 1 0 4 4 4 4 0 0 0-4-4zm9 4a7.47 7.47 0 0 0-.12-1.34l2.1-1.64-2-3.46-2.5 1a7.73 7.73 0 0 0-2.32-1.34l-.38-2.65H9.22l-.38 2.65a7.73 7.73 0 0 0-2.32 1.34l-2.5-1-2 3.46 2.1 1.64A7.47 7.47 0 0 0 3 12a7.47 7.47 0 0 0 .12 1.34l-2.1 1.64 2 3.46 2.5-1a7.73 7.73 0 0 0 2.32 1.34l.38 2.65h5.56l.38-2.65a7.73 7.73 0 0 0 2.32-1.34l2.5 1 2-3.46-2.1-1.64A7.47 7.47 0 0 0 21 12z'/></svg>");
}
.icon-search {
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M10 2a8 8 0 1 0 5.29 14l4.21 4.2 1.5-1.5-4.2-4.21A8 8 0 0 0 10 2zm0 2a6 6 0 1 1-6 6 6 6 0 0 1 6-6z'/></svg>");
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M10 2a8 8 0 1 0 5.29 14l4.21 4.2 1.5-1.5-4.2-4.21A8 8 0 0 0 10 2zm0 2a6 6 0 1 1-6 6 6 6 0 0 1 6-6z'/></svg>");
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
}

@keyframes toastProgress {
  from {
    width: 100%;
  }
  to {
    width: 0%;
  }
}

@keyframes itemIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes itemOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}

@keyframes tilePop {
  from {
    opacity: 0;
    transform: translate(var(--x, 0px), var(--y, 0px)) scale(0.6);
  }
  to {
    opacity: 1;
    transform: translate(var(--x, 0px), var(--y, 0px)) scale(1);
  }
}

@keyframes tileMerge {
  0% {
    transform: translate(var(--x, 0px), var(--y, 0px)) scale(1);
  }
  40% {
    transform: translate(var(--x, 0px), var(--y, 0px)) scale(1.08);
  }
  100% {
    transform: translate(var(--x, 0px), var(--y, 0px)) scale(1);
  }
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    flex-direction: row;
    overflow-x: auto;
  }
  .nav {
    flex-direction: row;
  }
  .profile-card {
    grid-template-columns: 1fr;
  }
}
