/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #030303;
  color: #F8F6F4;
  height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── App Shell ── */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

/* Scrollable area between status bar and bottom nav */
.app-shell__content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  /* space for filter tabs (50px) + bottom nav (95px) + gap */
  padding-bottom: 160px;
}

.app-content {
  min-height: 100%;
}

/* ── Loading / Error Pages ── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  color: #A8A8A8;
  font-size: 1rem;
}

.page--forbidden,
.page--service-unavailable {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  gap: 0.5rem;
  color: #A8A8A8;
}

.page--forbidden h1,
.page--service-unavailable h1 {
  font-size: 1.5rem;
  color: #F8F6F4;
}

.page--service-unavailable p {
  font-size: 0.9rem;
}

/* ── Header ── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 10px;
}

.header__title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #FFFFFF;
}

.header__balance {
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(20, 20, 20, 0.8);
  border-radius: 25px;
  padding: 4px 4px 4px 12px;
  font-size: 15px;
  font-weight: 590;
  color: #fff;
}

.header__balance-plus {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: rgba(44, 44, 44, 0.8);
  border-radius: 25px;
  font-size: 15px;
  color: #fff;
  line-height: 1;
}

/* ── Toggle Tabs (floating bottom) ── */
.filter-tabs-container {
  position: fixed;
  bottom: calc(95px + max(0px, env(safe-area-inset-bottom)));
  left: 25px;
  z-index: 10;
}

.toggle-tabs {
  display: flex;
  align-items: center;
  background: rgba(20, 20, 20, 0.5);
  border-radius: 30px;
  padding: 4px;
  gap: 0;
}

.toggle-tabs__tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 13.333px;
  font-weight: 510;
  color: #6E6E6E;
  cursor: pointer;
  border: none;
  background: transparent;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: -0.08px;
}

.toggle-tabs__tab--active {
  background: #343334;
  color: #FFFFFF;
  font-weight: 590;
}

.toggle-tabs__live-icon {
  flex-shrink: 0;
}

/* ── Sticky Page Header ── */
.app-content__sticky-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #030303;
}

/* ── Category Bar ── */
.category-bar {
  display: flex;
  gap: 0;
  padding: 0 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid #333333;
}

.category-bar::-webkit-scrollbar {
  display: none;
}

.category-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 10px;
  background: transparent;
  color: #636363;
  font-size: 14px;
  font-weight: 510;
  letter-spacing: -0.15px;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  min-width: 60px;
}

.category-chip--active {
  color: #FFFFFF;
}

.category-chip__icon {
  line-height: 1;
}

.category-chip__icon-img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
  opacity: 0.4;
}

.category-chip--active .category-chip__icon-img {
  opacity: 1;
}

.category-chip__label {
  line-height: 1;
  font-size: 14px;
}

/* ── Events list ── */
.events {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 16px 0;
}

.empty-state,
.error-state {
  margin: 16px;
  color: #A8A8A8;
  font-size: 0.9rem;
}

/* ── Event Card ── */
.event-card {
  position: relative;
  padding-top: 10px; /* room for timer pill overhanging top */
}

.event-card__countdown {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  background: #2D2D2D;
  border: 0.6px solid #1A1A1A;
  color: #A8A8A8;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: 22px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  z-index: 1;
  /* pill sits half-in, half-out of the card top edge */
  margin-top: 0;
}

.event-card__countdown-highlight {
  color: #FFFFFF;
  font-weight: 700;
}

.event-card__body {
  background: #131313;
  border-radius: 26px;
  /* top padding = pill height/2 (10px) + inner padding (14px) */
  padding: 24px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  isolation: isolate;
}

.event-card__logo-placeholder {
  background: #2D2D2D;
}

/* Header row: avatar + info + share */
.event-card__header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.event-card__logo {
  position: relative;
  width: 45px;
  height: 45px;
  flex-shrink: 0;
}

.event-card__logo-img {
  width: 45px;
  height: 45px;
  border-radius: 50px;
  object-fit: cover;
  display: block;
}

.event-card__live-badge {
  position: absolute;
  bottom: -2px;
  left: 8px;
  background: #EB0200;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 3px;
  letter-spacing: 0.02em;
  line-height: 12px;
}

.event-card__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
}

.event-card__source {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  line-height: 16px;
}

.event-card__question {
  font-size: 16px;
  font-weight: 590;
  color: #F8F6F4;
  letter-spacing: -0.31px;
  line-height: 21px;
}

.event-card__share {
  background: none;
  border: none;
  color: #FF7E06;
  font-size: 15px;
  font-weight: 590;
  cursor: pointer;
  padding: 0;
  line-height: 18px;
  flex-shrink: 0;
}

/* ── Bet Buttons ── */
.event-card__bets {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.event-card__bets-row {
  display: flex;
  gap: 8px;
}

.bet-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 25px;
  height: 42px;
  font-size: 15px;
  font-weight: 590;
  letter-spacing: -0.23px;
  text-align: center;
  cursor: pointer;
  transition: opacity 0.15s;
  line-height: 20px;
}

.bet-btn:active {
  opacity: 0.75;
}

.bet-btn--win {
  background: #18202F;
  color: #4789FF;
}

.bet-btn--lose {
  background: #3B152D;
  color: #F5009B;
}

/* ── Volume ── */
.event-card__volume {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.15px;
  color: #A5A5A5;
  line-height: 19px;
}

/* ── Bottom Nav ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-end;
  padding: 8px 25px max(25px, env(safe-area-inset-bottom));
  background: transparent;
  z-index: 20;
}

.bottom-nav__bar {
  display: flex;
  align-items: center;
  flex: 1;
  padding: 4px;
  background: rgba(28, 28, 30, 0.75);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  border: 0.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 30px;
  gap: 0;
}

.bottom-nav__item {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1px;
  flex: 1;
  padding: 6px 8px 7px;
  background: none;
  border: none;
  color: #6E6E6E;
  font-size: 10px;
  font-weight: 510;
  letter-spacing: -0.1px;
  cursor: pointer;
  border-radius: 30px;
  text-decoration: none;
  text-align: center;
}

.bottom-nav__item--active {
  color: #FFFFFF;
  background: #343334;
  font-weight: 590;
}

.bottom-nav__icon {
  font-size: 17px;
  line-height: 28px;
  display: block;
  width: 100%;
  text-align: center;
}

.bottom-nav__soon {
  position: absolute;
  top: 0;
  right: 12px;
  font-size: 8px;
  font-weight: 510;
  color: #FF7E06;
  letter-spacing: 0;
  white-space: nowrap;
  line-height: 12px;
}

/* ── Placeholder Pages ── */
.page--placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  color: #636363;
  font-size: 1.2rem;
  gap: 0.5rem;
}

.page--placeholder__icon {
  font-size: 3rem;
  opacity: 0.5;
}

/* ── Profile ── */
.profile-card {
  margin: 16px;
  padding: 16px;
  background: #0F0F0F;
  border: 1px solid #1E1E1E;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.profile-card__avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #1C1C1C;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.profile-card__identity {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 140px;
}

.profile-card__name {
  font-size: 18px;
  font-weight: 600;
  color: #FFFFFF;
}

.profile-card__username {
  font-size: 12px;
  color: #A8A8A8;
}

.profile-card__balance {
  text-align: right;
  min-width: 90px;
}

.profile-card__balance-label {
  font-size: 11px;
  color: #A8A8A8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.profile-card__balance-value {
  font-size: 18px;
  font-weight: 600;
  color: #FFFFFF;
}

.profile-card__meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #111111;
  border-radius: 12px;
  padding: 12px;
}

.profile-card__meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #A8A8A8;
}

.profile-card__meta-value {
  color: #F8F6F4;
  font-weight: 600;
}

/* ── Page Transition ── */
@keyframes slide-in-from-right {
  from { transform: translateX(30px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes slide-in-from-left {
  from { transform: translateX(-30px); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

.page-transition {
  height: 100%;
  overflow: visible;
}

.page--enter-right > * {
  animation: slide-in-from-right 220ms ease-out;
}

.page--enter-left > * {
  animation: slide-in-from-left 220ms ease-out;
}
