/* ─────────────────────────────────────────────────────────────────────────────
   Smash Point — app.css  v20260616.1
   Fix list vs original:
     • Match cards: consistent border, shadow depth, hover/active states
     • Chip alignment: no float-collapse bug in card header row
     • Player line: truncation + min-height so empty state doesn't collapse
     • Score line: correct color + spacing
     • Admin action footer: proper border separation
     • Schedule/Results page wrapper: top-gap so cards don't clip under eyebrow
     • Segment control (.seg): full-width on mobile
     • Card bottom-margin consistency (8px everywhere)
     • Bottom-nav safe-area inset for modern iOS/Android
   ───────────────────────────────────────────────────────────────────────────── */

/* ── Design tokens ───────────────────────────────────────────────────────── */
:root {
  --bg:          #EE9B3A;
  --paper:       #F7F2E8;
  --card:        #fff;
  --ink:         #221C14;
  --ink-soft:    #6F6657;
  --accent:      #E2701D;
  --accent-soft: #F8E3CC;
  --live:        #D9482B;
  --good:        #2E8C5A;
  --sky:         #DCEFF8;
  --sky-ink:     #2B6E8F;
  --board:       #1A2415;
  --panel:       #0D120B;
  --line:        #3F5A33;
  --radius:      18px;
  --card-shadow: 0 1px 4px rgba(0,0,0,.07), 0 2px 8px rgba(0,0,0,.05);
  --card-border: 1px solid rgba(0,0,0,.07);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
a { color: var(--accent); text-decoration: none; }

/* ── Page wrapper ────────────────────────────────────────────────────────── */
.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 16px 96px;
  /* Bottom safe-area for iPhones with home indicator */
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

/* ── Typography ──────────────────────────────────────────────────────────── */
.eyebrow {
  font-size: .66rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); display: block; margin-bottom: 2px;
}
h1, h2, h3 {
  font-family: 'Bricolage Grotesque', 'Inter', sans-serif;
  letter-spacing: -.02em; line-height: 1.1;
}
.h-lg { font-size: 1.5rem; font-weight: 800; }
.h-md { font-size: 1.2rem;  font-weight: 700; }
.muted { color: var(--ink-soft); }
.sub   { color: var(--ink-soft); font-size: .8rem; }

/* ── Generic card ────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: var(--card-border);
  padding: 16px;
  box-shadow: var(--card-shadow);
  margin-bottom: 10px;
}
.row {
  display: flex; align-items: center;
  justify-content: space-between; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid rgba(0,0,0,.055);
}
.row:last-child { border: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Chips ───────────────────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 999px; padding: 4px 11px;
  font-size: .66rem; font-weight: 600;
  white-space: nowrap; flex-shrink: 0;
}
.chip-live { background: var(--live); color: #fff; }
.chip-soft { background: var(--accent-soft); color: var(--accent); }
.chip-sky  { background: var(--sky); color: var(--sky-ink); }
.chip-done { background: #E2F2E8; color: var(--good); }
.chip-mut  { background: #EFEAE0; color: var(--ink-soft); }
.chip-warn { background: #FBE9D7; color: #A05A12; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: block; width: 100%; border: 0;
  border-radius: 14px; padding: 14px;
  font-weight: 700; font-size: .92rem;
  text-align: center; cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.btn:active   { opacity: .85; transform: scale(.98); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-dark   { background: #26211A; color: #fff; }
.btn-orange { background: var(--accent); color: #fff; }
.btn-line   { background: #fff; border: 1.5px solid rgba(0,0,0,.1); color: var(--ink); }
.btn-ghost  { background: transparent; color: var(--accent); }
.btn-sm {
  width: auto; display: inline-block;
  padding: 9px 14px; font-size: .78rem; border-radius: 11px;
}

/* ── Form fields ─────────────────────────────────────────────────────────── */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: .7rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 5px; }
.field input, .field select {
  width: 100%; border: 1.5px solid rgba(0,0,0,.08);
  background: #fff; border-radius: 13px;
  padding: 12px 13px; font: 600 .88rem 'Inter', sans-serif;
  transition: border-color .15s;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ── KPI tiles ───────────────────────────────────────────────────────────── */
.kpi { background: #fff; border-radius: 16px; padding: 13px; }
.kpi b    { font-family: 'Bricolage Grotesque'; font-size: 1.45rem; font-weight: 800; display: block; }
.kpi small { font-size: .66rem; font-weight: 600; color: var(--ink-soft); }
.kpi.t1   { background: var(--accent-soft); }
.kpi.t2   { background: var(--sky); }

/* ── Team dot ────────────────────────────────────────────────────────────── */
.team-dot {
  width: 30px; height: 30px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  font: 800 .65rem 'Bricolage Grotesque', sans-serif;
  color: #fff; margin-right: 8px; flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────────────────────
   MATCH CARD  (.mc)  — Used by match-card.js (inline styles) AND
                         match_card.php (CSS classes). Fixes the CSS-class
                         version so it matches the inline-style version exactly.
   ─────────────────────────────────────────────────────────────────────────── */
.mc {
  display: block;
  text-decoration: none;
  background: var(--card);
  border-radius: 16px;
  border: var(--card-border);
  padding: 14px 16px;
  margin-bottom: 8px;
  box-shadow: var(--card-shadow);
  color: var(--ink);
  cursor: pointer;
  transition: box-shadow .15s, transform .1s;
  /* FIX: use flex instead of float so the chip never collapses the row */
  overflow: visible;
}
.mc:hover  { box-shadow: 0 3px 10px rgba(0,0,0,.10); }
.mc:active { transform: scale(.99); box-shadow: 0 1px 4px rgba(0,0,0,.08); border-color: var(--accent); }

/* Card header row — title + chip side by side */
/* FIX: was float-based (mc-row + overflow:hidden) which caused height collapse */
.mc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
/* Backward-compat: keep .mc-row working for existing server-rendered PHP cards */
.mc-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  /* Remove the old float-collapse hack */
  overflow: visible;
  margin-bottom: 0;
}

.mc-chip {
  /* FIX: remove float:right — parent is now flex */
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  border-radius: 99px;
  padding: 5px 12px;
  font-size: .72rem; font-weight: 700;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
}
.mc-chip.live     { background: #D9482B; color: #fff; }
.mc-chip.done     { background: #E2F2E8; color: #1F7048; }
.mc-chip.upcoming { background: #DCEFF8; color: #1A5E8F; }
.mc-chip.mut      { background: #EFEAE0; color: #6F6657; }

.mc-title {
  font: 700 .9rem/1.35 'Inter', sans-serif;
  color: var(--ink);
  /* FIX: allow wrapping, do not overflow:hidden (was clipping long names) */
  flex: 1;
  min-width: 0; /* flex truncation fix */
}

/* Player line */
.mc-pl {
  font: 400 .75rem/1.4 'Inter', sans-serif;
  color: var(--ink-soft);
  margin-top: 5px;
  /* FIX: added min-height so line never collapses to zero */
  min-height: 1em;
}
.mc-pl b { font-weight: 700; color: #bbb; padding: 0 4px; }

/* Set scores */
.mc-sets {
  font: 700 .74rem 'Inter', sans-serif;
  color: var(--accent);
  margin-top: 5px;
  letter-spacing: .01em;
}

/* Admin action footer (Publish / Reopen buttons) */
.mc-foot {
  display: flex; gap: 6px;
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,.06);
  /* FIX: was missing clear, broke layout when card had float chip */
  clear: both;
}

/* ── Bottom navigation ────────────────────────────────────────────────────── */
.bnav {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: #fff;
  border-top: 1px solid rgba(0,0,0,.065);
  display: flex; justify-content: space-around;
  padding: 9px 6px 16px;
  /* Safe-area for iPhone home indicator */
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  max-width: 760px; margin: 0 auto;
  /* FIX: z-index so nav always appears above cards */
  z-index: 50;
}
.bnav a {
  font-size: .6rem; font-weight: 600; color: #9a9184;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  /* FIX: min tap target 44px */
  min-width: 44px; padding: 2px 4px;
}
.bnav a.on { color: var(--accent); }
.bnav i    { font-style: normal; font-size: 1.05rem; }

/* ── Live match card ─────────────────────────────────────────────────────── */
.live-card {
  display: block; text-decoration: none;
  background: linear-gradient(135deg, #E2701D, #EE9B3A);
  border-radius: 20px; padding: 15px; color: #fff; margin-bottom: 10px;
}
.live-scroll {
  display: flex; gap: 12px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px; margin: 0 -2px;
  scrollbar-width: none;
}
.live-scroll::-webkit-scrollbar { display: none; }
.live-scroll .live-card { flex: 0 0 86%; scroll-snap-align: center; margin-bottom: 0; }
.live-card.alt  { background: linear-gradient(135deg, #26211A, #4A3B28); }
.live-card.alt2 { background: linear-gradient(135deg, #2B6E8F, #4FA3C7); }

.ls { display: flex; align-items: center; justify-content: space-between; }
.ls .side { text-align: center; flex: 1; }
.ls .num  { font-family: 'Bricolage Grotesque'; font-weight: 800; font-size: 2.4rem; line-height: 1; }

/* ── Points table rank row ───────────────────────────────────────────────── */
.rank {
  display: grid;
  grid-template-columns: 1fr 32px 32px 38px 38px;
  align-items: center; font-size: .76rem; font-weight: 600;
  padding: 9px 0; border-bottom: 1px solid rgba(0,0,0,.055);
  column-gap: 4px;
}
.rank > span, .rank > b {
  display: flex; align-items: center; justify-content: center;
}
.rank > span:first-child { justify-content: flex-start; }
.rank.head {
  font-size: .58rem; font-weight: 700; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: .06em;
}
.rank.head > * { justify-content: center; }
.rank.head > span:first-child { justify-content: flex-start; }

/* ── Toast notification ──────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 80px;
  transform: translateX(-50%);
  background: #26211A; color: #fff;
  padding: 11px 18px; border-radius: 12px;
  font-size: .82rem; font-weight: 600;
  z-index: 80; opacity: 0; transition: opacity .2s;
  pointer-events: none; white-space: nowrap;
}
.toast.on { opacity: 1; }

/* ── Offline / auth screens ──────────────────────────────────────────────── */
.center-screen {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  background: var(--bg); padding: 24px;
}
.offline-card {
  background: var(--paper); border-radius: 22px;
  padding: 30px; text-align: center; max-width: 360px;
}
.big-emoji { font-size: 3rem; margin-bottom: 10px; }

/* ── Flash messages ──────────────────────────────────────────────────────── */
.flash {
  background: #FBE9D7; color: #A05A12;
  border-radius: 12px; padding: 10px 14px;
  font-size: .8rem; font-weight: 600; margin-bottom: 12px;
}
.flash.err { background: #F8DCD6; color: #B23A22; }

/* ── Segment control (.seg) ──────────────────────────────────────────────── */
.seg {
  display: flex; background: #EFEAE0;
  border-radius: 12px; padding: 4px; margin-bottom: 12px;
  /* FIX: overflow:hidden clips active pill shadow on tight screens */
  overflow: visible;
}
.seg button {
  flex: 1; border: 0; border-radius: 9px;
  padding: 9px 6px; /* FIX: reduced horizontal padding so 4 tabs fit on 320px */
  font-weight: 600; font-size: .72rem; /* FIX: was .78rem, clips on small phones */
  background: transparent; color: var(--ink-soft); cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, box-shadow .15s;
}
.seg button.on {
  background: #fff; color: var(--ink);
  box-shadow: 0 1px 3px rgba(0,0,0,.09);
}

/* ── Skeleton loader ─────────────────────────────────────────────────────── */
@keyframes skel-shine {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skel {
  background: linear-gradient(90deg, #e8e2d6 25%, #f2ede4 50%, #e8e2d6 75%);
  background-size: 200% 100%;
  animation: skel-shine 1.4s ease-in-out infinite;
  border-radius: 10px; min-height: 18px;
}
.skel-line { height: 14px; border-radius: 7px; margin-bottom: 8px; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-card { border-radius: 22px; max-width: 480px; margin: auto; }

/* ─────────────────────────────────────────────────────────────────────────────
   RESPONSIVE BREAKPOINTS
   ───────────────────────────────────────────────────────────────────────────── */

/* Small tablet / large phone landscape (≥ 560px) */
@media (min-width: 560px) {
  body { padding: 24px 28px 80px; }
  .grid2 { grid-template-columns: 1fr 1fr; }
  .live-scroll .live-card { flex-basis: 48%; }
  .h-lg { font-size: 2rem; }
  .seg button { padding: 9px 20px; font-size: .85rem; }
  .modal-card { border-radius: 22px; max-width: 480px; margin: auto; }
}

/* Tablet portrait (≥ 768px) */
@media (min-width: 768px) {
  body { padding: 28px 40px 90px; max-width: 720px; margin: 0 auto; }
  .card  { padding: 20px; }
  .btn   { padding: 14px 20px; }
  .bnav  { max-width: 720px; left: 50%; transform: translateX(-50%); }
  .live-scroll .live-card { flex-basis: 44%; }
  .mc    { padding: 16px 20px; }
}

/* Desktop (≥ 1024px) */
@media (min-width: 1024px) {
  body { padding: 32px 0 100px; max-width: 860px; }
  .bnav { max-width: 860px; }
  .h-lg { font-size: 2.4rem; }
  .live-scroll .live-card { flex-basis: 36%; }
  .grid2 { gap: 16px; }
}

/* Very small phones (≤ 360px) — ensure cards are readable */
@media (max-width: 360px) {
  .seg button { font-size: .65rem; padding: 8px 4px; }
  .mc-chip    { font-size: .65rem; padding: 4px 9px; }
  .mc-title   { font-size: .82rem; }
}
