*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    -system-ui, sans-serif;
  background: #f5f7fb;
  color: #111827;
}

.ts-root {
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  padding: 8px 8px 64px;
  display: flex;
  flex-direction: column;
}

/* HEADER */

.ts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  margin-bottom: 8px;
}

.ts-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ts-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.ts-brand-block {
  display: flex;
  flex-direction: column;
}

.ts-brand-name {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.1;
}

.ts-brand-tagline {
  font-size: 10px;
  color: #6b7280;
}

/* LANG SWITCHER */

.ts-lang-wrap {
  position: relative;
  margin-left: 6px;
}

.ts-lang-btn {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  font-size: 11px;
  cursor: pointer;
}

.ts-lang-menu {
  position: absolute;
  top: 26px;
  left: 0;
  min-width: 100px;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
  font-size: 10px;
  padding: 4px 0;
  display: none;
  z-index: 20;
}

.ts-lang-menu div {
  padding: 4px 8px;
  cursor: pointer;
}

.ts-lang-menu div:hover {
  background: #f3f4ff;
}

/* HEADER RIGHT */

.ts-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ts-wallet-btn-small {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #22c1f1;
  background: #f0f9ff;
  font-size: 9px;
  color: #0369a1;
  cursor: pointer;
  white-space: nowrap;
}

.ts-wallet-btn-small:active {
  transform: translateY(1px);
}

.ts-user-label-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.ts-user-label {
  font-size: 11px;
  color: #111827;
}

.ts-role-label {
  font-size: 8px;
  padding: 2px 6px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #e5e7eb;
  color: #4b5563;
}

.ts-role-label.creator {
  background: #e0f2fe;
  color: #0369a1;
}

.ts-role-label.admin {
  background: #fee2e2;
  color: #b91c1c;
}

/* SEARCH */

.ts-search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 2px 4px;
}

.ts-search-input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  font-size: 11px;
  outline: none;
  background: #ffffff;
}

.ts-search-input::placeholder {
  color: #9ca3af;
}

.ts-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: none;
  background: #e5e7ff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
}

.ts-icon-btn:hover {
  background: #d1d5ff;
}

/* CATEGORIES */

.ts-categories {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 4px;
  padding: 0 2px 4px;
  margin-bottom: 2px;
}

.ts-categories::-webkit-scrollbar {
  height: 0;
}

.ts-category-pill {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  border: none;
  background: #eef2ff;
  color: #4b5563;
  font-size: 10px;
  cursor: pointer;
}

.ts-category-pill.active {
  background: #22c1f1;
  color: #ffffff;
}

/* STATUS FILTERS */

.ts-filters-bar {
  display: flex;
  gap: 4px;
  padding: 0 2px 4px;
  font-size: 9px;
}

.ts-filter-chip {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: #f3f4ff;
  color: #6b7280;
  cursor: pointer;
}

.ts-filter-chip-active,
.ts-filter-chip:hover {
  background: #22c1f1;
  color: #ffffff;
}

/* RATE + WALLET LINE */

.ts-rate-wallet {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  margin: 2px 0 6px;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
  font-size: 11px;
}

.ts-rate-label {
  color: #6b7280;
  font-size: 10px;
}

.ts-rate-value {
  font-weight: 600;
  font-size: 12px;
}

.ts-rate-extra {
  font-size: 10px;
  color: #9ca3af;
}

/* ROLE ACTIONS */

.ts-role-actions {
  display: none;
  gap: 6px;
  margin: 4px 2px 6px;
}

.ts-role-btn {
  flex: 1;
  padding: 6px 10px;
  border-radius: 999px;
  border: none;
  font-size: 10px;
  cursor: pointer;
  background: #22c1f1;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(34, 193, 241, 0.3);
}

.ts-role-btn-secondary {
  background: #eef2ff;
  color: #374151;
  box-shadow: none;
}

/* MARKETS LIST */

.ts-markets-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 2px 8px;
  overflow-y: auto;
}

/* MARKET CARD */

.market-card {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  padding: 10px 10px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.market-card-left {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
}

.market-logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.market-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
}

.market-status-pill {
  margin-top: 2px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.market-status-active {
  background: #ecfdf5;
  color: #047857;
}

.market-status-pending {
  background: #fffbeb;
  color: #b45309;
}

.market-status-resolved {
  background: #eef2ff;
  color: #4338ca;
}

.market-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.market-question {
  font-size: 13px;
  line-height: 1.3;
  font-weight: 600;
  color: #111827;
}

.market-meta-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 10px;
  color: #6b7280;
}

.market-category {
  text-transform: uppercase;
  font-weight: 600;
}

.market-dot {
  opacity: 0.5;
}

.market-volume {
  font-weight: 500;
}

.market-deadline {
  font-size: 10px;
  color: #4b5563;
}

.market-source {
  margin-top: 2px;
  font-size: 9px;
  color: #2563eb;
  text-decoration: none;
}

.market-source:hover {
  text-decoration: underline;
}

/* RIGHT SIDE */

.market-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  min-width: 90px;
  margin-left: 8px;
}

.market-buttons {
  display: flex;
  gap: 4px;
}

.market-btn {
  min-width: 44px;
  padding: 6px 8px;
  border-radius: 999px;
  border: none;
  font-size: 10px;
  cursor: default;
  font-weight: 600;
}

.market-btn-yes {
  background: #22c1f1;
  color: #ffffff;
}

.market-btn-no {
  background: #fee2e2;
  color: #b91c1c;
}

.market-prob {
  margin-top: 4px;
  font-size: 10px;
  color: #6b7280;
  text-align: right;
}

/* ADMIN BUTTON */

.market-admin-activate {
  margin-top: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: none;
  font-size: 9px;
  cursor: pointer;
  background: #22c1f1;
  color: #ffffff;
}

/* SKELETON */

.skeleton {
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(243, 244, 246, 0) 0%,
    rgba(243, 244, 246, 0.9) 50%,
    rgba(243, 244, 246, 0) 100%
  );
  animation: ts-shimmer 1.4s infinite;
}

.skeleton-box,
.skeleton-line,
.skeleton-pill {
  background: #e5e7eb;
  border-radius: 999px;
}

.skeleton-box {
  width: 36px;
  height: 36px;
}

.skeleton-line {
  height: 7px;
  margin-bottom: 4px;
}

.skeleton-line.w-80 {
  width: 80%;
}

.skeleton-line.w-70 {
  width: 70%;
}

.skeleton-line.w-40 {
  width: 40%;
}

.skeleton-pill {
  width: 50px;
  height: 18px;
  margin-top: 4px;
}

@keyframes ts-shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* ПУСТЫЕ СОСТОЯНИЯ */

.ts-empty {
  padding: 24px 12px;
  text-align: center;
  color: #6b7280;
}

.ts-empty-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}

.ts-empty-sub {
  font-size: 10px;
}

/* BOTTOM NAV */

.ts-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -4px 14px rgba(15, 23, 42, 0.08);
  padding: 4px 6px;
  gap: 4px;
}

.ts-bottom-nav-btn {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 6px 4px;
  font-size: 10px;
  color: #6b7280;
  cursor: pointer;
}

.ts-bottom-nav-btn-active {
  background: #eef2ff;
  color: #111827;
}

/* DEBUG (скрыт) */

.ts-debug {
  display: none;
  font-size: 10px;
  margin-top: 8px;
  color: #6b7280;
}
