/* =========================================================
   App CSS — I See What Game We Are Playing!
   Minimal nav (home-only) + teal theme + cards + ticker
   ========================================================= */

/* -----------------------------
   Design tokens
----------------------------- */
:root {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --text: #141416;
  --muted: #5b5f66;

  --accent: #0f7f73;
  --accent-soft: rgba(15, 127, 115, 0.10);
  --tint-1: rgba(15, 127, 115, 0.12);
  --tint-2: rgba(15, 127, 115, 0.18);

  --border: rgba(20, 20, 22, 0.10);

  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.06);
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.08);

  --radius: 16px;
  --radius-sm: 12px;

  --container: 1100px;

  /* Layout spacing (tightened) */
  --pad-page: 16px;
  --gap: 14px;

  /* Buttons */
  --btn-radius: 12px;
  --btn-pad-y: 10px;
  --btn-pad-x: 14px;

  --focus: 2px solid rgba(20, 20, 22, 0.35);
}

/* -----------------------------
   Reset / base
----------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
}

/* Prevent accidental sideways page scroll */
html, body {
  overflow-x: clip;
}

/* Basic typography rhythm (tightened) */
h1, h2, h3 {
  margin: 0 0 8px 0;
  line-height: 1.15;
}

p {
  margin: 0 0 10px 0;
  color: var(--muted);
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible {
  outline: var(--focus);
  outline-offset: 3px;
}

/* Utility container */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--pad-page);
}

/* -----------------------------
   Main + page wrapper
----------------------------- */
main {
  display: block;
  overflow: visible;
  padding-top: 0;
}

.page-wrap {
  max-width: var(--container);
  margin: 0 auto;
  padding: 12px var(--pad-page) 36px;
  overflow-wrap: anywhere;
}

/* -----------------------------
   Page topbar (non-home pages)
----------------------------- */
.page-topbar {
  position: sticky;
  top: 0;
  z-index: 1100;
  background: var(--surface);
  border-bottom: 1px solid rgba(0,0,0,.08);
  box-shadow: var(--shadow-sm);
  padding: 10px 14px;
}

.page-topbar__home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  color: inherit;
}

.home-arrow {
  font-size: 18px;
  line-height: 1;
}

/* -----------------------------
   Ticker (global)
----------------------------- */
.ticker-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.ticker-wrap.is-hidden { display: none; }

.ticker-label {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .08em;
  opacity: .75;
  white-space: nowrap;
}

.ticker {
  overflow: hidden;
  flex: 1;
  white-space: nowrap;
}

.ticker-text {
  display: inline-block;
  padding-left: 100%;
  padding-right: 30px;
  animation: ticker-scroll 12s linear infinite;
}

.ticker-wrap:hover .ticker-text {
  animation-play-state: paused;
}

@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* -----------------------------
   Page hero (tinted)
----------------------------- */
.page-hero {
  background: linear-gradient(180deg, var(--tint-2), #fff);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  padding: 16px;
  margin-bottom: var(--gap);
  min-width: 0;
}

.page-hero h1 {
  font-size: 34px;
  letter-spacing: -0.02em;
  color: var(--text);
}

.page-hero p {
  margin: 6px 0 0;
  color: var(--muted);
}

/* teal underline */
.page-hero::after {
  content: "";
  display: block;
  width: 84px;
  height: 4px;
  border-radius: 999px;
  background: var(--accent);
  margin-top: 12px;
}

/* -----------------------------
   Buttons
----------------------------- */
.btn {
  appearance: none;
  border: 1px solid rgba(20, 20, 22, 0.12);
  background: var(--surface);
  color: var(--text);

  border-radius: var(--btn-radius);
  padding: var(--btn-pad-y) var(--btn-pad-x);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  font-weight: 700;
  cursor: pointer;

  transition: transform 120ms ease, box-shadow 120ms ease, background 160ms ease, border-color 160ms ease;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.08);
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.07);
}

.btn-primary {
  background: var(--text);
  color: #fff;
  border-color: rgba(20, 20, 22, 0.20);
}

.btn-primary:hover {
  background: rgba(20, 20, 22, 0.92);
}

.btn-secondary {
  background: rgba(20, 20, 22, 0.04);
  color: var(--text);
}

.btn-secondary:hover {
  background: rgba(20, 20, 22, 0.07);
}

/* -----------------------------
   Actions row (Payouts page, etc.)
----------------------------- */
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--gap);
}

.meta-line {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* -----------------------------
   Sheet embed card + frame
----------------------------- */
.sheet-card {
  background: linear-gradient(180deg, var(--tint-1), #fff);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  min-width: 0;
}

.sheet-frame {
  width: 100%;
  height: 78vh;
  min-height: 520px;
  border: 0;
  display: block;
}

/* -----------------------------
   Payouts / generic cards + tables
----------------------------- */
.payouts-stack {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.payouts-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  padding: 16px;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.payouts-card h2 {
  margin: 0 0 10px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(20, 20, 22, 0.12);
  position: relative;
}

.payouts-card h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 84px;
  height: 4px;
  border-radius: 999px;
  background: var(--accent);
}

/* Tables + scroll containment (critical for mobile) */
.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  min-width: 0;

  position: relative;
  padding-right: 6px;
  padding-left: 6px;
}

/* Table scroll hint (edge fades) */
.table-scroll::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 28px;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(to left, #fff, rgba(255,255,255,0));
  opacity: 0;
  transition: opacity 180ms ease;
}

.table-scroll::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 22px;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(to right, #fff, rgba(255,255,255,0));
  opacity: 0;
  transition: opacity 180ms ease;
}

.table-scroll.has-overflow::after { opacity: 1; }
.table-scroll.is-end::after { opacity: 0; }
.table-scroll.is-start::before { opacity: 0; }
.table-scroll.is-middle::before { opacity: 1; }

.payouts-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  max-width: 100%;
  min-width: 0;
}

/* Only the wide tables should scroll on mobile */
.payouts-card.daily-quota .payouts-table,
.payouts-card.overall-quota .payouts-table {
  min-width: 520px;
}

.payouts-table th,
.payouts-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(20, 20, 22, 0.10);
  text-align: left;
  white-space: nowrap;
}

.payouts-table thead th {
  font-weight: 800;
  color: rgba(20, 20, 22, 0.75);
  background: rgba(15, 127, 115, 0.06);
}

.payouts-table .num {
  text-align: right;
  white-space: nowrap;
}

.payouts-table .day {
  font-weight: 800;
}

/* Long formulas/code can force overflow on mobile */
code {
  display: inline-block;
  max-width: 100%;
  overflow-x: auto;
  vertical-align: bottom;
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(20, 20, 22, 0.04);
}

/* -----------------------------
   Scoring card internals
----------------------------- */
.scoring-card .card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.card-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(15, 127, 115, 0.35);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
}

.scoring-grid {
  display: grid;
  gap: 12px;
}

@media (min-width: 720px) {
  .scoring-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.scoring-block {
  border: 1px solid rgba(20, 20, 22, 0.10);
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(180deg, var(--tint-1), #fff);
  min-width: 0;
}

.scoring-block h3 {
  margin: 0 0 8px 0;
}

.scoring-list {
  margin: 0;
  padding-left: 18px;
}

.scoring-list li + li {
  margin-top: 6px;
}

.muted {
  color: rgba(20, 20, 22, 0.55);
}

/* Bullets */
.bullets {
  padding-left: 18px;
}

.bullets li + li {
  margin-top: 6px;
}

/* =========================================================
   Home Hub (Primary Actions)
   ========================================================= */
.hub-actions {
  display: grid;
  gap: 12px;
  margin: 0 0 var(--gap) 0;
}

@media (min-width: 720px) {
  .hub-actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 980px) {
  .hub-actions {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.hub-card {
  display: block;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  padding: 12px;
  min-width: 0;

  transition: transform 120ms ease, box-shadow 120ms ease, border-color 160ms ease;
}

.hub-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(0,0,0,0.10);
  border-color: rgba(15,127,115,.30);
}

.hub-card:active {
  transform: translateY(0);
  box-shadow: var(--shadow-card);
}

.hub-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.hub-icon {
  font-size: 20px;
  line-height: 1;
}

.hub-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(15,127,115,.35);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 900;
  font-size: 12px;
  white-space: nowrap;
}

.hub-card h2 {
  margin: 0 0 4px 0;
  font-size: 18px;
}

.hub-card p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.hub-card--secondary {
  background: linear-gradient(180deg, var(--tint-1), #fff);
}

/* -----------------------------
   Rules page cards
----------------------------- */
.rules-grid {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

@media (min-width: 900px) {
  .rules-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.rule-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  padding: 16px;
  min-width: 0;
}

.rule-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(20,20,22,0.12);
  position: relative;
}

.rule-head::after {
  content:"";
  position:absolute;
  left:0;
  bottom:-2px;
  width:84px;
  height:4px;
  border-radius:999px;
  background: var(--accent);
}

.rule-title { margin: 0; }

.rule-tag {
  display:inline-flex;
  align-items:center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(15,127,115,.35);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
}

.rule-card ul {
  margin: 0;
  padding-left: 18px;
}

.rule-card li + li { margin-top: 6px; }

.sub-list {
  margin-top: 8px;
  padding-left: 18px;
}

.rule-note {
  margin-top: 12px;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(20,20,22,0.10);
  background: linear-gradient(180deg, var(--tint-1), #fff);
  color: rgba(20,20,22,0.78);
}

/* -----------------------------
   Pairings page styling
----------------------------- */
.pairings-tools {
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 6px 0 14px;
}

.pairings-tools label {
  font-weight: 800;
  color: rgba(20,20,22,.80);
}

.pairings-tools select {
  appearance: none;
  border: 1px solid rgba(20,20,22,.18);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
  line-height: 1.1;
  box-shadow: 0 1px 0 rgba(0,0,0,.04);
}

.pairings-summary {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  padding: 14px;
  margin: 8px 0 14px;
}

.pairings-summary h2 {
  margin: 0 0 10px 0;
}

.day-block {
  display:grid;
  gap: 10px;
  margin-top: 12px;
}

.day-title {
  font-weight: 900;
  color: rgba(20,20,22,.80);
}

.pairings-details {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  padding: 10px 12px 14px;
  margin: 10px 0;
  overflow: hidden;
}

.pairings-details > summary {
  list-style: none;
  cursor: pointer;
  font-weight: 900;
  padding: 10px 8px;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  user-select: none;
}

.pairings-details > summary::-webkit-details-marker { display:none; }

.pairings-details > summary::after {
  content: "▸";
  font-size: 16px;
  color: rgba(20,20,22,.55);
  transform: rotate(0deg);
  transition: transform 160ms ease;
}

.pairings-details[open] > summary::after {
  transform: rotate(90deg);
}

.foursome-grid {
  display:grid;
  gap: 10px;
  padding: 12px 8px 4px;
}

@media (min-width: 900px) {
  .foursome-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 640px) and (max-width: 899px) {
  .foursome-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.foursome-card {
  border: 1px solid rgba(20,20,22,.10);
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(180deg, var(--tint-1), #fff);
  min-width: 0;
  position: relative;
  padding-top: 14px;
}

.foursome-card ul {
  margin: 0;
  padding-left: 18px;
}

.foursome-card li {
  line-height: 1.25;
}

.foursome-card li + li {
  margin-top: 6px;
}

.foursome-card strong {
  color: rgba(20,20,22,.90);
}

.page-wrap hr {
  border: 0;
  border-top: 1px solid rgba(20,20,22,.12);
  margin: 16px 0;
}

.group-badge {
  position: absolute;
  top: 12px;
  right: 12px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 6px 10px;
  border-radius: 999px;

  border: 1px solid rgba(15,127,115,.35);
  background: var(--accent-soft);
  color: var(--accent);

  font-weight: 900;
  font-size: 12.5px;
  letter-spacing: .01em;
  line-height: 1;
  box-shadow: 0 1px 0 rgba(0,0,0,.03);
}

/* -----------------------------
   Mobile tweaks
----------------------------- */
@media (max-width: 720px) {
  :root {
    --pad-page: 14px;
    --gap: 12px;
  }

  .page-wrap {
    padding: 10px var(--pad-page) 30px;
  }

  .page-hero h1 {
    font-size: 26px;
  }

  /* tighten section headings on phones */
  h2 {
    font-size: 1.25rem;
    margin-bottom: 8px;
  }

  .sheet-frame {
    height: 72vh;
    min-height: 480px;
  }

  .payouts-card {
    padding: 14px;
  }

  .payouts-table th,
  .payouts-table td {
    padding: 8px 10px;
  }

  .rules-grid {
    gap: 10px;
    margin-top: 10px;
  }

  .rule-card {
    padding: 14px;
  }

  .pairings-details {
    padding: 8px 10px 12px;
  }

  .foursome-grid {
    padding: 10px 6px 2px;
  }

  .group-badge {
    top: 10px;
    right: 10px;
  }

  /* Home Hub: make cards 2-up for faster tapping */
  .hub-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .hub-card {
    padding: 12px 10px;
  }

  .hub-card h2 {
    font-size: 16px;
  }

  .hub-card p {
    font-size: 13px;
  }
}

/* =========================================================
   Weather horizontal scroller
   ========================================================= */
.wx-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 1fr); /* card width */
  gap: 12px;

  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;

  padding: 6px 2px 10px;
  scroll-snap-type: x mandatory;
}

.wx-card {
  scroll-snap-align: start;
}

/* Slightly wider cards on bigger screens */
@media (min-width: 720px) {
  .wx-strip {
    grid-auto-columns: minmax(260px, 1fr);
  }
}

/* Optional: subtle scrollbar styling */
.wx-strip::-webkit-scrollbar { height: 8px; }
.wx-strip::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.15);
  border-radius: 999px;
}

/* =========================================================
   Weather condition badge styling
   ========================================================= */

.wx-condition {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 6px 12px;
  border-radius: 999px;

  font-size: 13px;
  font-weight: 700;

  border: 1px solid rgba(20,20,22,.12);
  background: rgba(20,20,22,.04);
  color: rgba(20,20,22,.75);
}

/* Specific weather moods */

.wx-clear {
  background: rgba(255, 200, 0, 0.15);
  border-color: rgba(255, 200, 0, 0.35);
  color: #8a5b00;
}

.wx-cloudy {
  background: rgba(120, 140, 160, 0.15);
  border-color: rgba(120, 140, 160, 0.35);
  color: #3c4b57;
}

.wx-rain {
  background: rgba(30, 120, 200, 0.12);
  border-color: rgba(30, 120, 200, 0.35);
  color: #1b5d8e;
}

.wx-storm {
  background: rgba(100, 80, 180, 0.14);
  border-color: rgba(100, 80, 180, 0.40);
  color: #43387a;
}

.wx-fog {
  background: rgba(150, 150, 150, 0.14);
  border-color: rgba(150,150,150,.35);
  color: #555;
}

/* Keep condition + wind badges on a single line */
.wx-condition-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;
}
