/* Pattern finder. Layers on game.css for the shell (colors, topbar, footer).
   Mobile-first: the chart scrolls inside its own container so the page body
   never scrolls sideways, and every tap target clears 44px. */

.patterns-body { overflow-x: hidden; }

.pat-main {
  display: block; width: 100%; max-width: 860px;
  margin: 0 auto; padding: 4px 18px calc(40px + env(safe-area-inset-bottom));
}

/* series colours: validated categorical slots 1-5 on this dark surface
   (dataviz validator, --mode dark --surface #161926: all checks pass). */
.pat-main {
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181;
  --now: #f1f3f9;
}

/* .brand is a div elsewhere on the site; as a link it would inherit the
   browser's blue underline. */
.topbar .brand { text-decoration: none; color: var(--text); }
.topbar .brand:hover { text-decoration: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.lede { color: var(--muted); font-size: 16px; margin: 0 0 4px; max-width: 60ch; }

/* ---------------------------------------------------------------- form -- */
.pat-form { display: flex; gap: 10px; margin: 22px 0 8px; flex-wrap: wrap; }
.pat-form input {
  flex: 1 1 200px; min-width: 0;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text); border-radius: 14px;
  padding: 15px 16px; font-size: 16px;   /* 16px stops iOS zoom on focus */
  font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
}
.pat-form input::placeholder {
  color: var(--dim); text-transform: none; letter-spacing: normal;
  font-weight: 400;
}
.pat-form input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91,140,255,.18);
}
.pat-form button {
  flex: 0 0 auto; min-height: 50px; padding: 0 22px;
  background: var(--accent); color: #08090d; border: 0; border-radius: 14px;
  font-size: 15px; font-weight: 700; cursor: pointer;
}
.pat-form button:disabled { opacity: .55; cursor: default; }

.pat-status { color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.pat-status.err { color: var(--red); }

/* ------------------------------------------------------------- honesty -- */
.truth {
  margin: 22px 0 0; padding: 18px;
  background: rgba(245,196,81,.06);
  border: 1px solid rgba(245,196,81,.28); border-radius: var(--radius);
}
.truth h2 {
  margin: 0 0 14px; font-size: 12px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--gold); font-weight: 700;
}
.truth-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.tv {
  font-size: 30px; font-weight: 700; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.tl { color: var(--muted); font-size: 12.5px; line-height: 1.45; margin-top: 4px; }
.truth-note {
  margin: 14px 0 0; color: var(--text); font-size: 14px; line-height: 1.6;
  padding-top: 13px; border-top: 1px solid rgba(245,196,81,.2);
}

/* --------------------------------------------------------------- chart -- */
.chart-card {
  margin: 18px 0 0; padding: 18px 16px 16px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius);
}
.chart-head {
  display: flex; gap: 12px; align-items: flex-start;
  justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px;
}
.chart-head h2 { margin: 0; font-size: 19px; letter-spacing: -.01em; }
.chart-sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.chart-toggle { display: flex; gap: 2px; background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 11px; padding: 3px; }
.chart-toggle button {
  min-height: 44px; padding: 0 15px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.chart-toggle button.on { background: var(--surface-2); color: var(--text); }

.chart-wrap { position: relative; }

/* The plot scrolls horizontally, so the value scale is drawn OUTSIDE the
   scroller and pinned — otherwise the axis slides off screen exactly when a
   phone user scrolls to the part of the chart they came for. */
.yaxis {
  position: absolute; left: 0; top: 0; z-index: 2;
  background: var(--surface); pointer-events: none;
}
/* The chart is drawn at a fixed pixel width so 180 daily points stay legible.
   Squeezing that into a 393px phone makes every line a hairline, so instead
   it keeps its size and scrolls inside this container — the page body still
   never scrolls sideways. */
.chart-scroll {
  overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  margin: 0 -16px; padding: 0 16px;   /* bleed to the card edge on mobile */
}
#chart { display: block; height: auto; }
.scroll-hint {
  display: none; margin: 8px 0 0; color: var(--dim); font-size: 12px;
}
@media (max-width: 720px) { .scroll-hint { display: block; } }

.tooltip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--bg); border: 1px solid var(--line-bright);
  border-radius: 10px; padding: 9px 11px; font-size: 12.5px;
  line-height: 1.5; box-shadow: 0 8px 26px rgba(0,0,0,.55);
  min-width: 150px; font-variant-numeric: tabular-nums;
}
.tooltip .tt-h { font-weight: 700; margin-bottom: 5px; font-size: 12px;
  color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.tooltip .tt-r { display: flex; align-items: center; gap: 7px;
  justify-content: space-between; }
.tooltip .tt-k { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.sw { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }

.legend {
  display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px;
  padding-top: 13px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted);
}
.legend .li { display: flex; align-items: center; gap: 7px; }

/* --------------------------------------------------------------- table -- */
.table-wrap { overflow-x: auto; margin-top: 6px; }
.pat-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.pat-table th {
  text-align: left; font-size: 11px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--dim); font-weight: 600;
  padding: 0 10px 9px 0; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.pat-table td { padding: 11px 10px 11px 0; border-bottom: 1px solid var(--bg-soft); }
.pat-table .n { text-align: right; font-variant-numeric: tabular-nums; }
.pat-table .up { color: var(--green); font-weight: 600; }
.pat-table .dn { color: var(--red); font-weight: 600; }
.pat-table .mk { display: flex; align-items: center; gap: 8px; white-space: nowrap; }

.disclaim { margin: 14px 0 0; color: var(--dim); font-size: 12px; line-height: 1.55; }

/* -------------------------------------------------------------- method -- */
.method { margin: 22px 0 0; color: var(--muted); font-size: 14.5px; line-height: 1.65; }
.method h2 { color: var(--text); font-size: 17px; margin: 0 0 10px; }
.method ul { margin: 12px 0; padding-left: 20px; }
.method li { margin: 7px 0; }
.method strong { color: var(--text); }
.method code {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 6px; padding: 1px 6px; font-size: 12.5px;
}
.method-foot { font-size: 13px; color: var(--dim); }

@media (max-width: 480px) {
  .pat-main { padding-left: 14px; padding-right: 14px; }
  .chart-card { padding: 15px 12px 13px; }
  .tv { font-size: 26px; }
}
