/* =========================================================
   100 IN A ROW  –  mobile-first UI
   ========================================================= */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
  background: #111;
  color: #fff;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { border: none; background: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ---------- App wrapper (mobile first, 640px on desktop) -- */
.app {
  width: 100%;
  max-width: 640px;
  min-height: 100vh;
  margin: 0 auto;
  background: #000;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
@media (min-width: 641px) {
  body { display: flex; align-items: stretch; justify-content: center; }
  .app {
    height: 100vh;
    min-height: 0;
    box-shadow: 0 0 0 1px #1a1a1a;
  }
}
.content { flex: 1; overflow-y: auto; position: relative; z-index: 2; }

/* ---------- 100 IN A ROW logo ----------------------------- */
.logo { display: flex; justify-content: center; }
.logo__row { display: flex; gap: 4px; }
.logo__ball {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Arial Black", Arial, sans-serif;
  font-weight: 900;
  font-size: 15px;
  color: #fff;
  letter-spacing: -0.5px;
}
.logo--inline { gap: 4px; padding: 12px 0; }
.logo--big {
  flex-direction: column;
  gap: 6px;
  align-items: center;
  padding: 70px 0 40px;
}
.logo--big .logo__ball {
  width: 72px; height: 72px;
  font-size: 42px;
}
.logo__ball--green { background: #3cb44a; }
.logo__ball--blue  { background: #2f9ee0; }
.logo__ball--orange{ background: #f5a623; }
.logo__ball--red   { background: #d32b2b; }
.logo__ball--checker {
  color: transparent;
  background-color: #fff;
  background-image:
    linear-gradient(45deg,  #000 25%, transparent 25%),
    linear-gradient(-45deg, #000 25%, transparent 25%),
    linear-gradient(45deg,  transparent 75%, #000 75%),
    linear-gradient(-45deg, transparent 75%, #000 75%);
  background-size: 10px 10px;
  background-position: 0 0, 0 5px, 5px -5px, -5px 0;
}
.logo--big .logo__ball--checker {
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

/* ---------- Football pitch background --------------------- */
.pitch {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 45%;
  background: #051405;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.pitch--short { height: 30%; }
.pitch::before {
  content: "";
  position: absolute;
  left: -80%; right: -80%; top: 0; bottom: -60%;
  background-image:
    linear-gradient(rgba(60,255,90,0.55) 1px, transparent 1px),
    linear-gradient(90deg, rgba(60,255,90,0.55) 1px, transparent 1px);
  background-size: 44px 44px;
  transform: perspective(220px) rotateX(62deg);
  transform-origin: center top;
}
.pitch::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top,
      transparent 0%, rgba(0,0,0,0.15) 50%, #000 100%);
}
.pitch__circle {
  position: absolute;
  left: 50%;
  top: 18%;
  width: 130%;
  height: 60px;
  transform: translateX(-50%);
  border: 2px solid rgba(255,255,255,0.55);
  border-radius: 50%;
  z-index: 1;
}
.pitch__circle::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 12px; height: 12px;
  background: #888;
  border-radius: 50%;
}

/* ---------- Login / Auth ---------------------------------- */
.auth {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 28px;
  position: relative;
  z-index: 2;
}
.auth__form { margin-top: 10px; }
.field {
  width: 100%;
  padding: 18px 22px;
  font-size: 18px;
  border-radius: 6px;
  background: #fff;
  color: #333;
  border: none;
  box-shadow: 0 0 18px rgba(60, 120, 255, 0.35);
}
.btn {
  display: block;
  width: 100%;
  padding: 18px 22px;
  font-size: 18px;
  font-weight: 700;
  border-radius: 6px;
  text-align: center;
  background: #3b9ce6;
  color: #fff;
  box-shadow: 0 0 18px rgba(60, 120, 255, 0.45);
}
.btn + .field, .field + .btn, .field + .field { margin-top: 14px; }
.btn--green { background: #3eb64a; box-shadow: none; }
.btn--wide  { border-radius: 0; padding: 20px; font-size: 22px; letter-spacing: 2px; }
.btn--arrow::after {
  content: "\2192";
  display: inline-block;
  margin-left: 14px;
  font-weight: 900;
}
.auth__link {
  display: block;
  text-align: center;
  margin-top: 20px;
  color: #fff;
  text-decoration: underline;
  font-size: 17px;
}

/* ---------- Top bar with small logo ----------------------- */
.topbar {
  padding: 12px 12px 8px;
  background: #000;
  flex-shrink: 0;
  position: relative;
  z-index: 5;
}

/* ---------- Profile + countdown (dashboard/stats) --------- */
.header-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 14px 10px;
}
.avatar {
  width: 72px; height: 72px;
  border-radius: 10px;
  border: 2px solid #3eb64a;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, #554, #221);
  position: relative;
}
.avatar--lg { width: 96px; height: 96px; }
.avatar::after {
  content: "";
  position: absolute;
  left: 50%; top: 38%;
  transform: translate(-50%, -50%);
  width: 34%; height: 34%;
  background: #3a2a20;
  border-radius: 50%;
}
.avatar::before {
  content: "";
  position: absolute;
  left: 50%; bottom: -6%;
  transform: translateX(-50%);
  width: 80%; height: 60%;
  background: #1b1614;
  border-radius: 50% 50% 0 0 / 40% 40% 0 0;
}

.countdown-wrap { flex: 1; }
.countdown__title {
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 1.5px;
  margin-bottom: 4px;
}
.countdown {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.countdown__seg {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}
.countdown__seg .v {
  font-family: "Arial Black", Arial, sans-serif;
  font-weight: 900;
  font-size: 46px;
  line-height: 1;
}
.countdown__seg .u {
  color: #777;
  font-size: 14px;
  font-weight: 800;
  margin-top: 2px;
}
.countdown__seg--muted .v { color: #555; }

/* ---------- 60 IN A ROW progress bar --------------------- */
.progress {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
}
.progress__label {
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}
.progress__label b { display: block; font-size: 32px; }
.progress__label small { font-size: 10px; letter-spacing: 1px; }
.progress__bar {
  flex: 1;
  height: 36px;
  background-image:
    repeating-linear-gradient(90deg,
      #fff 0 2px, transparent 2px 5px);
  background-position: center;
  background-size: 100% 70%;
  background-repeat: no-repeat;
}
.progress__flag {
  width: 32px; height: 32px;
  background-color: #fff;
  background-image:
    linear-gradient(45deg,  #000 25%, transparent 25%),
    linear-gradient(-45deg, #000 25%, transparent 25%),
    linear-gradient(45deg,  transparent 75%, #000 75%),
    linear-gradient(-45deg, transparent 75%, #000 75%);
  background-size: 10px 10px;
  background-position: 0 0, 0 5px, 5px -5px, -5px 0;
  border-radius: 4px;
}

/* ---------- Tabs ----------------------------------------- */
.tabs { display: flex; margin-top: 6px; }
.tab {
  flex: 1;
  padding: 16px;
  text-align: center;
  font-weight: 800;
  letter-spacing: 2px;
  background: #1a1a1a;
  color: #fff;
  font-size: 16px;
}
.tab--active {
  background: #000;
  color: #3eb64a;
  box-shadow: inset 0 -3px 0 #3eb64a;
}

/* ---------- Search --------------------------------------- */
.search { padding: 12px 12px 10px; background: #000; }
.search input {
  width: 100%;
  padding: 14px 18px;
  border-radius: 4px;
  border: none;
  background: #fff;
  font-size: 16px;
  color: #333;
}

/* ---------- Matches list --------------------------------- */
.matches {
  padding: 0 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #000;
}
.match {
  display: flex;
  align-items: stretch;
  gap: 2px;
  background: #2a2a2a;
  border-radius: 3px;
  overflow: hidden;
  height: 44px;
}
.match__time {
  width: 58px;
  background: #1a1a1a;
  font-weight: 900;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #dcdcdc;
  letter-spacing: 0.5px;
}
.match__stars {
  display: flex;
  align-items: center;
  padding: 0 8px 0 10px;
  font-size: 11px;
  color: #f5a623;
  min-width: 70px;
  letter-spacing: 1px;
}
.match__stars--trophy { color: #f5a623; font-size: 18px; }
.match__flag {
  width: 24px;
  height: 18px;
  margin-right: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.flag-es {
  background: linear-gradient(to bottom,
    #d32b2b 0 30%,
    #f5a623 30% 70%,
    #d32b2b 70%);
}
.match__teams {
  flex: 1;
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0.4px;
  display: flex;
  align-items: center;
}
.match__action {
  width: 48px;
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
}
.match__action--add    { color: #fff; font-size: 28px; font-weight: 300; }
.match__action--check  { color: #3eb64a; font-size: 22px; font-weight: 900; }
.match__action--remove { color: #d32b2b; font-size: 20px; font-weight: 900; }
.match__action--dot    { padding: 0; }
.match__action .dot {
  width: 20px; height: 20px; border-radius: 50%;
  display: inline-block;
}
.match__action .dot--won  { background: #3eb64a; }
.match__action .dot--play { background: #f5a623; }
.match__action .dot--lost { background: #d32b2b; }
.match__action .dot--next {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid #fff;
  position: relative;
}
.match__action .dot--next::after {
  content: "";
  position: absolute;
  left: 50%; top: 15%;
  width: 2px; height: 35%;
  background: #fff;
  transform: translateX(-50%);
}
.match__action .dot--next::before {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 35%; height: 2px;
  background: #fff;
  transform: translate(-50%, 0);
}

/* ---------- CTA strip ------------------------------------ */
.cta-strip {
  flex-shrink: 0;
  width: 100%;
  position: relative;
  z-index: 3;
}

/* ---------- Bottom nav ----------------------------------- */
.bottom-nav {
  display: flex;
  flex-shrink: 0;
  background: #000;
  padding: 8px 0 10px;
  position: relative;
  z-index: 5;
  border-top: 1px solid rgba(255,255,255,0.04);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 2px;
}
.nav-item svg { width: 24px; height: 24px; fill: #fff; }
.nav-item--active { color: #3eb64a; }
.nav-item--active svg { fill: #3eb64a; }

/* ---------- Ticket / Confirm screen ---------------------- */
.confirm-title {
  text-align: center;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 18px 12px 14px;
}

/* ---------- Stats grid ----------------------------------- */
.stats-grid {
  padding: 10px 12px 4px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  position: relative;
  z-index: 2;
}
.stat {
  background: #1a1a1a;
  padding: 10px 12px 14px;
  min-height: 102px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat__label {
  font-weight: 900;
  font-size: 13px;
  line-height: 1.05;
  color: #3eb64a;
  letter-spacing: 0.5px;
}
.stat__label--white { color: #fff; }
.stat__value {
  font-family: "Arial Black", Arial, sans-serif;
  font-size: 52px;
  font-weight: 900;
  line-height: 1;
  margin-top: auto;
}
.stat__value--green { color: #3eb64a; }
.stat__value--red   { color: #d32b2b; }
.stat__sub {
  color: #3eb64a;
  font-size: 11px;
  font-weight: 800;
  margin-top: -4px;
}

/* ---------- Legend --------------------------------------- */
.legend {
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 12px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  position: relative;
  z-index: 2;
}
.legend__item { display: flex; align-items: center; gap: 6px; }
.legend__dot { width: 14px; height: 14px; border-radius: 50%; }
.legend__dot--next {
  border: 2px solid #fff;
  background: transparent;
  position: relative;
}
.legend__dot--next::before,
.legend__dot--next::after {
  content: "";
  position: absolute;
  background: #fff;
}
.legend__dot--next::before {
  left: 50%; top: 14%;
  width: 2px; height: 38%;
  transform: translateX(-50%);
}
.legend__dot--next::after {
  left: 50%; top: 50%;
  width: 40%; height: 2px;
  transform: translate(-50%, 0);
}

/* ---------- Race / TRKA screen --------------------------- */
.race-head {
  position: relative;
  padding: 14px 0 26px;
  text-align: center;
  background: #000;
  flex-shrink: 0;
  z-index: 3;
}
.race-head__value {
  font-family: "Arial Black", Arial, sans-serif;
  font-size: 52px;
  font-weight: 900;
  line-height: 1;
}
.race-head__label {
  font-size: 11px;
  font-weight: 800;
  color: #888;
  letter-spacing: 2px;
  margin-top: 2px;
}
.race-head__pointer {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 14px solid #d32b2b;
}

.race {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: #000;
}
.race__scroll {
  flex: 1;
  overflow-x: auto;
  overflow-y: auto;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.race-grid {
  position: relative;
  display: grid;
  grid-template-columns: 40px 50px repeat(30, 44px);
  min-width: max-content;
}
.race-cell {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-weight: 800;
  font-size: 14px;
}
.race-cell--rank {
  position: sticky;
  left: 0;
  background: #000;
  z-index: 3;
}
.race-cell--avatar {
  position: sticky;
  left: 40px;
  background: #000;
  z-index: 3;
}
.race-cell--avatar .av {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #665, #221);
  position: relative;
  overflow: hidden;
  border: 1px solid #333;
}
.race-cell--avatar .av::after {
  content: "";
  position: absolute;
  left: 50%; top: 30%;
  transform: translate(-50%, -50%);
  width: 40%; height: 40%;
  background: #3a2a20;
  border-radius: 50%;
}
.race-cell--avatar .av::before {
  content: "";
  position: absolute;
  left: 50%; bottom: -10%;
  transform: translateX(-50%);
  width: 90%; height: 60%;
  background: #1b1614;
  border-radius: 50% 50% 0 0;
}

.race-cell--head {
  height: 42px;
  font-size: 13px;
  color: #fff;
}
.race-cell--head span {
  width: 26px; height: 26px;
  border: 2px solid #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  background: #000;
}

.race-cell .status {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.status--won  { background: #3eb64a; }
.status--play { background: #f5a623; }
.status--lost { background: #d32b2b; }

.race-cell .icon {
  font-size: 22px;
  line-height: 1;
}

/* Red "now" timeline (absolute inside grid) */
.race-now {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #d32b2b;
  pointer-events: none;
  z-index: 2;
}

/* Match toast / tooltip on race screen */
.race-toast {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #101010;
  border: 2px solid #3eb64a;
  padding: 6px 8px 6px 0;
  font-weight: 900;
  font-size: 12px;
  white-space: nowrap;
  z-index: 4;
  overflow: hidden;
}
.race-toast__date {
  background: #111;
  padding: 6px 8px;
  color: #fff;
  font-weight: 900;
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  font-size: 11px;
  border-right: 1px solid #222;
}
.race-toast__date b { font-size: 12px; }
.race-toast__date i { font-style: normal; color: #888; font-size: 9px; }
.race-toast__flag {
  width: 22px; height: 16px;
  border-radius: 2px;
  margin-right: 4px;
}
.race-toast::after {
  content: "";
  position: absolute;
  bottom: -14px;
  right: 18px;
  width: 0; height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 14px solid #3eb64a;
}
.race-toast::before {
  content: "";
  position: absolute;
  bottom: -10px;
  right: 20px;
  width: 0; height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 11px solid #101010;
  z-index: 1;
}

/* Race short-alias cells for cleaner markup */
.race-grid .x {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-right: 1px solid rgba(255,255,255,0.03);
}
.race-grid .x > b {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: block;
}
.race-grid .x.w > b { background: #3eb64a; }
.race-grid .x.p > b { background: #f5a623; }
.race-grid .x.l > b { background: #d32b2b; width: 20px; height: 20px; }
.race-grid .x.ico { font-size: 22px; line-height: 1; }
.race-grid .x.rank {
  position: sticky;
  left: 0;
  background: #000;
  z-index: 3;
  font-weight: 800;
  font-size: 14px;
}
.race-grid .x.av {
  position: sticky;
  left: 40px;
  background: #000;
  z-index: 3;
}
.race-grid .x.av > .pic {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #665, #221);
  position: relative;
  overflow: hidden;
  border: 1px solid #333;
}
.race-grid .x.av > .pic::after {
  content: "";
  position: absolute;
  left: 50%; top: 30%;
  transform: translate(-50%, -50%);
  width: 40%; height: 40%;
  background: #3a2a20;
  border-radius: 50%;
}
.race-grid .x.av > .pic::before {
  content: "";
  position: absolute;
  left: 50%; bottom: -10%;
  transform: translateX(-50%);
  width: 90%; height: 60%;
  background: #1b1614;
  border-radius: 50% 50% 0 0;
}
.race-grid .x.head {
  height: 42px;
}
.race-grid .x.head > span {
  width: 26px; height: 26px;
  border: 2px solid #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  color: #fff;
  background: #000;
}

/* ---------- Index / menu --------------------------------- */
.menu { padding: 40px 28px 80px; position: relative; z-index: 2; }
.menu h1 {
  text-align: center;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 1px;
  margin: 18px 0 22px;
}
.menu a {
  display: block;
  padding: 16px 20px;
  background: #1a1a1a;
  border-radius: 6px;
  margin-bottom: 8px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #fff;
}
.menu a:hover { background: #222; color: #3eb64a; }
