/* ============ Match Chart (match-chart.html) ============
   Uses the site tokens from style.css. The printable sheet (.mc-sheet) only shows when printing. */
.mc { background: var(--navy); color: var(--white); }
.mc-inner { max-width: 1040px; margin: 0 auto; padding-inline: max(20px, env(safe-area-inset-left, 0px)); }
.mc h1, .mc h2, .mc h3 { font-family: var(--font-display); letter-spacing: .02em; text-wrap: balance; }
.mc-muted { opacity: .7; font-size: .95rem; }

/* hero */
.mc-hero { padding: 8.5rem 0 3rem; background:
  radial-gradient(ellipse 55% 70% at 88% 0%, rgba(202, 219, 42, .16), transparent 70%),
  linear-gradient(180deg, #071029, var(--navy)); }
.mc-hero h1 { margin: .4rem 0 1rem; font-size: clamp(2.3rem, 6vw, 4rem); line-height: 1.02; text-transform: uppercase; }
.mc-hero h1 em { font-style: italic; font-weight: 400; color: var(--ball); }
.mc-lede { max-width: 64ch; font-size: 1.1rem; opacity: .9; }
.mc-hero__ctas { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.8rem; }
.mc-hero__ctas button, .mc-actions button { cursor: pointer; font-family: var(--font-display); }

/* app */
.mc-app { padding: 2.5rem 0 3.5rem; }
.mc-app__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .4rem 1.5rem; margin-bottom: 1.2rem; }
.mc-app__head h2 { margin: .2rem 0 0; font-size: clamp(1.8rem, 4vw, 2.5rem); text-transform: uppercase; }
.mc-saved { font-size: .85rem; opacity: .7; }

.mc-setup { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1.4rem; }
.mc-setup label { display: grid; gap: .3rem; font: 600 .72rem var(--font-display); letter-spacing: .14em; text-transform: uppercase; color: var(--orange-hi); }
.mc-setup input, .mc-setup select {
  width: 100%; min-width: 0; padding: .6rem .7rem; font: 1rem var(--font-body); letter-spacing: 0; text-transform: none;
  color: var(--white); background: rgba(255, 255, 255, .06); border: 1px solid rgba(207, 232, 255, .25); border-radius: 10px;
  color-scheme: dark;
}
.mc-setup select option { color: #111; }
.mc-setup input:focus-visible, .mc-setup select:focus-visible { outline: 2px solid var(--ball); outline-offset: 1px; }

.mc-sets { display: flex; gap: .5rem; margin-bottom: 1rem; }
.mc-set {
  flex: 1; padding: .7rem .5rem; cursor: pointer; font: 600 1rem var(--font-display); letter-spacing: .08em; text-transform: uppercase;
  color: var(--white); background: rgba(255, 255, 255, .04); border: 1px solid rgba(207, 232, 255, .2); border-radius: 12px;
}
.mc-set[aria-selected="true"] { background: var(--ball); border-color: var(--ball); color: #141b05; }
.mc-set:focus-visible { outline: 3px solid var(--orange-hi); outline-offset: 2px; }
.mc-set__score { margin-left: .5rem; font-weight: 400; opacity: .8; }

/* board: one row per stat, player on the left, opponent on the right */
.mc-board { padding: 1rem 1.2rem 1.2rem; border-radius: 20px; background:
  linear-gradient(180deg, rgba(37, 84, 166, .35), rgba(22, 48, 94, .35)); border: 1px solid rgba(207, 232, 255, .18); }
.mc-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(7rem, 1.1fr) minmax(0, 1fr); align-items: center; gap: .8rem; padding: .35rem 0; }
.mc-row__label { text-align: center; font: 500 .95rem var(--font-display); letter-spacing: .05em; text-transform: uppercase; line-height: 1.15; }
.mc-row--names { padding-bottom: .6rem; border-bottom: 1px solid rgba(207, 232, 255, .18); }
.mc-row--names .mc-row__label { color: var(--ball); }
.mc-who { font: 600 1.2rem var(--font-display); letter-spacing: .04em; overflow-wrap: anywhere; }
.mc-who--me { text-align: right; color: var(--orange-hi); }
.mc-who--opp { text-align: left; }
.mc-group { margin: 1rem 0 .1rem; text-align: center; font: 600 .72rem var(--font-display); letter-spacing: .3em; text-transform: uppercase; color: var(--orange-hi); }

.mc-count { display: flex; align-items: center; gap: .45rem; }
.mc-count[data-who="me"] { justify-content: flex-end; }
.mc-count[data-who="opp"] { flex-direction: row-reverse; justify-content: flex-end; }
.mc-count__plus {
  min-width: 5.2rem; height: 3rem; cursor: pointer; border-radius: 14px; border: 2px solid transparent;
  font: 600 1.45rem var(--font-display); color: #141b05; background: var(--ball);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18); transition: transform .08s ease, filter .2s ease;
  touch-action: manipulation;
}
.mc-count[data-who="opp"] .mc-count__plus { background: var(--line); color: #0d1533; }
.mc-count__plus:hover { filter: brightness(1.06); }
.mc-count__plus:active { transform: scale(.95); }
.mc-count__minus, .mc-step {
  width: 2.3rem; height: 2.3rem; flex: none; cursor: pointer; border-radius: 50%;
  font: 600 1.2rem/1 var(--font-body); color: var(--white); background: rgba(5, 8, 24, .45); border: 1px solid rgba(207, 232, 255, .3);
  touch-action: manipulation;
}
.mc-count__minus:disabled, .mc-step:disabled { opacity: .3; cursor: default; }
.mc-count button:focus-visible, .mc-step:focus-visible { outline: 3px solid var(--orange-hi); outline-offset: 2px; }

.mc-games__cell { display: flex; align-items: center; gap: .6rem; }
.mc-row--games > .mc-games__cell:first-child { justify-content: flex-end; }
.mc-games__cell output { min-width: 2.2rem; text-align: center; font: 700 2rem var(--font-display); }
.mc-row--games { padding: .6rem 0 .2rem; }

.mc-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0 2rem; }
.mc-actions button:disabled { opacity: .45; cursor: default; }
.mc-actions button:disabled:hover { background: rgba(5, 8, 24, .25); color: var(--white); }

/* summary and takeaway */
.mc-results { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.mc-results h3 { margin-bottom: .7rem; font-size: 1.35rem; text-transform: uppercase; }
.mc-table-wrap { overflow-x: auto; }
.mc-table { width: 100%; border-collapse: collapse; font-size: .98rem; }
.mc-table th, .mc-table td { padding: .5rem .6rem; border-bottom: 1px solid rgba(207, 232, 255, .15); text-align: left; }
.mc-table thead th { font: 600 .78rem var(--font-display); letter-spacing: .12em; text-transform: uppercase; color: var(--orange-hi); }
.mc-table td { font: 600 1.05rem var(--font-display); text-align: center; }
.mc-table thead th:not(:first-child) { text-align: center; }
.mc-table tbody th { font-weight: 400; }
.mc-score { margin-top: .6rem; }
.mc-takeaway { padding: 1.2rem 1.3rem; border-radius: 18px; background: rgba(202, 219, 42, .08); border: 1px solid rgba(202, 219, 42, .35); }
.mc-tips { list-style: none; display: grid; gap: .9rem; }
.mc-tips li { padding-left: 1.1rem; border-left: 3px solid var(--ball); }
.mc-tips p { margin-bottom: .25rem; }
.mc-tips a { font: 600 .8rem var(--font-display); letter-spacing: .12em; text-transform: uppercase; color: var(--ball); }
.mc-tips a:hover { text-decoration: underline; }

/* how to */
.mc-how { padding: 3.5rem 0; background: linear-gradient(180deg, var(--navy), #0a1230); }
.mc-how h2 { margin: .2rem 0 1.2rem; font-size: clamp(1.7rem, 4vw, 2.3rem); text-transform: uppercase; }
.mc-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1.5rem; padding-left: 1.3rem; max-width: 900px; }
.mc-steps li::marker { color: var(--ball); font-family: var(--font-display); font-weight: 600; }
.mc-steps strong { color: var(--orange-hi); }
.mc-how__sub { margin: 2.2rem 0 1rem; font-size: 1.35rem; text-transform: uppercase; }
.mc-terms { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.mc-terms div { padding: 1rem 1.1rem; border-radius: 14px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(207, 232, 255, .15); }
.mc-terms dt { font: 600 1.05rem var(--font-display); letter-spacing: .05em; text-transform: uppercase; color: var(--ball); margin-bottom: .3rem; }
.mc-terms dd { opacity: .88; font-size: .97rem; }

/* phones and tablets */
@media (max-width: 860px) {
  .mc-setup { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mc-setup label:nth-child(4) { grid-column: 1 / -1; }
  .mc-results { grid-template-columns: 1fr; }
  .mc-terms { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .mc-hero { padding-top: 7rem; }
  .mc-board { padding: .8rem .6rem 1rem; }
  .mc-row { grid-template-columns: minmax(0, 1fr) 5.6rem minmax(0, 1fr); gap: .4rem; }
  .mc-row__label { font-size: .8rem; letter-spacing: .02em; }
  .mc-count { gap: .3rem; }
  .mc-count__plus { min-width: 0; width: 100%; max-width: 4.6rem; height: 2.9rem; font-size: 1.3rem; }
  .mc-count__minus, .mc-step { width: 2rem; height: 2rem; }
  .mc-who { font-size: 1rem; }
  .mc-games__cell { gap: .3rem; }
  .mc-games__cell output { min-width: 1.6rem; font-size: 1.6rem; }
  .mc-steps, .mc-terms { grid-template-columns: 1fr; }
  .mc-set { font-size: .9rem; }
  .mc-set__score { display: block; margin: 0; font-size: .8rem; }
}
@media (prefers-reduced-motion: reduce) {
  .mc-count__plus { transition: none; }
  .mc-count__plus:active { transform: none; }
}

/* ============ printable sheet ============ */
.mc-sheet { display: none; }

@media print {
  @page { size: letter portrait; margin: 12mm; }
  body { background: #fff !important; color: #000 !important; }
  body > *:not(.mc-sheet) { display: none !important; }
  .mc-sheet { display: block; color: #000; font: 10.5pt var(--font-body); }
  .mc-sheet h2, .mc-sheet h3 { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .04em; }
  .mc-sheet__head { display: flex; justify-content: space-between; align-items: flex-end; padding-bottom: 6pt; border-bottom: 2.5pt solid #000; }
  .mc-sheet__head h2 { font-size: 24pt; line-height: 1; }
  .mc-sheet__brand { font: 600 8.5pt var(--font-display); letter-spacing: .22em; text-transform: uppercase; }
  .mc-sheet__site { font-size: 8.5pt; }
  .mc-sheet__fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8pt 16pt; margin: 12pt 0 14pt; }
  .mc-sheet__fields p { display: flex; gap: 6pt; align-items: flex-end; }
  .mc-sheet__fields span { font: 600 8pt var(--font-display); letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; }
  .mc-sheet__fields b { flex: 1; min-height: 15pt; border-bottom: 1pt solid #000; font-weight: 700; }
  .mc-sheet__table { width: 100%; border-collapse: collapse; table-layout: fixed; }
  .mc-sheet__table th, .mc-sheet__table td { border: 1pt solid #000; padding: 3pt 4pt; text-align: center; }
  .mc-sheet__table thead th { font: 600 8.5pt var(--font-display); letter-spacing: .08em; text-transform: uppercase; background: #eee; }
  .mc-sheet__table thead tr:first-child th[colspan] { font-size: 10pt; }
  .mc-sheet__table tbody th { width: 24%; text-align: left; font-weight: 700; font-size: 9.5pt; }
  .mc-sheet__table td { font-weight: 700; font-size: 11pt; }
  .mc-sheet.is-blank .mc-sheet__table tbody tr { height: 34pt; }
  .mc-sheet.is-blank .mc-sheet__calc { height: 22pt !important; }
  .mc-sheet__table tbody tr { height: 22pt; }
  .mc-sheet__total { background: #f3f3f3; }
  .mc-sheet__table td:nth-child(5) { border-right-width: 2.5pt; }
  .mc-sheet__hint { margin-top: 4pt; font-size: 8.5pt; font-style: italic; }
  .mc-sheet__notes { display: grid; grid-template-columns: 1fr 1fr; gap: 18pt; margin-top: 14pt; }
  .mc-sheet__notes h3 { font-size: 11pt; margin-bottom: 4pt; }
  .mc-sheet__notes p { margin-top: 8pt; font-size: 9.5pt; }
  .mc-sheet__lines { height: 112pt; background: repeating-linear-gradient(transparent 0 21pt, #000 21pt 22pt); }
  .mc-sheet__line { min-height: 18pt; border-bottom: 1pt solid #000; font-size: 9.5pt; }
  .mc-sheet * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
