/* Branding taken from logo 03: blue / red diamond on navy */
:root {
  --navbar-height: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --uni_margin: 15px;
  --item_gap: 10px;
  --uniRadius: 12px;

  --colorBlue: #0256FD;
  --colorBlueSoft: #E6EEFF;
  --colorRed: #F5283C;
  --colorRedSoft: #FFE8EA;
  --colorNavy: #141F3A;
  --colorWhite: #FFFFFF;
  --colorBg: #F6F7FB;
  --colorGrey: #E3E6EF;
  --colorMuted: #6B7390;
  --colorGreen: #13A06B;
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  margin: 0;
}

html { background-color: var(--colorNavy); }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  color: var(--colorNavy);
  background-color: var(--colorBg);
  overflow: hidden;
}

button { font: inherit; color: inherit; }

#content-container {
  position: absolute;
  top: calc(var(--navbar-height) + var(--safe-top));
  bottom: calc(var(--navbar-height) + var(--safe-bottom));
  left: 0;
  right: 0;
  overflow-y: auto;
  padding-bottom: 24px;
}

h3 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.2px;
  margin: 0;
  padding: var(--uni_margin) var(--uni_margin) 8px;
}

.muted { color: var(--colorMuted); font-size: 0.85rem; }
.up { color: var(--colorGreen); font-weight: 700; }
.down { color: var(--colorRed); font-weight: 700; }

/* Cards & lists */
.card {
  background: var(--colorWhite);
  margin: 0 var(--uni_margin) var(--item_gap);
  border-radius: var(--uniRadius);
  box-shadow: 0 2px 10px rgba(20, 31, 58, 0.06);
  padding: 14px 16px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.row .grow { flex: 1; min-width: 0; }
.row .name { font-weight: 600; }

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--colorWhite);
  background: var(--colorBlue);
}

.avatar.red { background: var(--colorRed); }
.avatar.big { width: 72px; height: 72px; font-size: 1.6rem; }

.rating-pill {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: var(--colorBlueSoft);
  color: var(--colorBlue);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.9rem;
}

/* Activity chips */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 var(--uni_margin) 12px;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  border: 1.5px solid var(--colorGrey);
  background: var(--colorWhite);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.chip.active {
  background: var(--colorNavy);
  border-color: var(--colorNavy);
  color: var(--colorWhite);
}

/* Segmented toggle (Nearby / Friends) */
.segmented {
  display: flex;
  margin: var(--uni_margin) var(--uni_margin) 12px;
  background: var(--colorGrey);
  border-radius: var(--uniRadius);
  padding: 3px;
}

.segmented button {
  flex: 1;
  border: none;
  background: none;
  padding: 8px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}

.segmented button.active {
  background: var(--colorWhite);
  box-shadow: 0 1px 4px rgba(20, 31, 58, 0.12);
}

/* Buttons */
.btn {
  border: none;
  border-radius: var(--uniRadius);
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  background: var(--colorBlue);
  color: var(--colorWhite);
  transition: transform 200ms ease-out;
  touch-action: manipulation;
}

.btn:active { transform: scale(0.95); transition: transform 80ms ease-in; }
.btn.red { background: var(--colorRed); }
.btn.ghost { background: var(--colorGrey); color: var(--colorNavy); }
.btn.small { padding: 6px 12px; font-size: 0.85rem; }
.btn.block { display: block; width: calc(100% - 2 * var(--uni_margin)); margin: 0 var(--uni_margin) var(--item_gap); }

/* Profile header */
.profile {
  text-align: center;
  padding: 24px var(--uni_margin) 8px;
}

.profile .avatar { margin: 0 auto 10px; }
.profile .handle { font-size: 1.3rem; font-weight: 800; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--item_gap);
  margin: 0 var(--uni_margin) var(--item_gap);
}

.stat-tile {
  background: var(--colorWhite);
  border-radius: var(--uniRadius);
  padding: 12px 8px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(20, 31, 58, 0.06);
}

.stat-tile .value { font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-tile .label { font-size: 0.75rem; color: var(--colorMuted); }

/* Rating chart */
.chart { width: 100%; height: 160px; display: block; }

/* Forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 6px; }
.field select, .field input {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1.5px solid var(--colorGrey);
  border-radius: 10px;
  background: var(--colorWhite);
  color: var(--colorNavy);
  user-select: text;
  -webkit-user-select: text;
}

.odds {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--colorMuted);
  margin-top: 4px;
}

.empty {
  text-align: center;
  color: var(--colorMuted);
  padding: 40px var(--uni_margin);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 31, 58, 0.5);
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--uni_margin);
}

.modal-overlay[hidden] { display: none; }

.modal-content {
  background: var(--colorWhite);
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  max-width: 380px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.result-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--navbar-height) + var(--safe-bottom) + 16px);
  transform: translateX(-50%);
  background: var(--colorNavy);
  color: var(--colorWhite);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  z-index: 30000;
  white-space: nowrap;
}
