/* ---------------------------------------------------------------
   Tippschein - mobile first, thumb sized score boxes
   --------------------------------------------------------------- */

:root {
  --bg:        #f1eee8;
  --card:      #ffffff;
  --ink:       #14161a;
  --muted:     #6f6a61;
  --line:      #e4dfd5;
  --accent:    #c8102e;
  --ring:      rgba(200, 16, 46, .25);
  --box-bg:    #fbfaf7;
  --box-line:  #d5cfc3;

  /* one source of truth for box size, so the column labels line up */
  --box-w:     3.5rem;
  --box-h:     3.75rem;
  --box-gap:   .5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:       #0e1013;
    --card:     #181b21;
    --ink:      #f3f2ef;
    --muted:    #9a9ea6;
    --line:     #262a31;
    --accent:   #ff4d6a;
    --ring:     rgba(255, 77, 106, .3);
    --box-bg:   #10131a;
    --box-line: #39404a;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: .75rem .75rem 2rem;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.slip {
  max-width: 26rem;
  margin: 0 auto;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .1), 0 10px 30px -18px rgba(0, 0, 0, .5);
  overflow: hidden;
}

/* --- head ----------------------------------------------------- */

.slip__head {
  padding: 1.125rem 1rem .875rem;
  border-bottom: 3px solid var(--accent);
}

.slip__title {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.1;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 800;
}

.slip__sub {
  margin: .3rem 0 0;
  font-size: .8125rem;
  color: var(--muted);
}

/* --- column labels above the boxes ---------------------------- */

.cols {
  display: flex;
  justify-content: flex-end;
  gap: var(--box-gap);
  padding: .5rem 1rem .25rem;
}

.cols__label {
  width: var(--box-w);
  text-align: center;
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --- matches -------------------------------------------------- */

.matches {
  margin: 0;
  padding: 0;
  list-style: none;
}

.match {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: .625rem;
  padding: .5rem 1rem;
  border-top: 1px solid var(--line);
}

.match__no {
  font-size: .875rem;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.match__teams {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.35;
}

.team {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.team--away { color: var(--muted); font-weight: 550; }

/* --- score boxes ---------------------------------------------- */

.match__score {
  display: flex;
  gap: var(--box-gap);
}

.score {
  width: var(--box-w);
  height: var(--box-h);
  padding: 0;
  border: 2px solid var(--box-line);
  border-radius: 10px;
  background: var(--box-bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 1.75rem;        /* >= 16px keeps iOS from zooming on focus */
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  touch-action: manipulation;
  scroll-margin-block: 4rem;
  transition: border-color .12s ease, box-shadow .12s ease;
}

.score.is-filled {
  border-color: var(--ink);
  background: var(--card);
}

.score:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--ring);
}

/* --- foot ----------------------------------------------------- */

.foot {
  padding: 1rem;
  border-top: 1px solid var(--line);
}

.counter {
  margin: 0 0 .5rem;
  font-size: .9375rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.counter.is-done { color: var(--accent); }

.bar {
  height: 6px;
  margin-bottom: .875rem;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.bar__fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width .18s ease;
}

.share {
  display: block;
  width: 100%;
  min-height: 3.25rem;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: .01em;
  cursor: pointer;
  touch-action: manipulation;
}

.share:active { transform: translateY(1px); }

.share:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.status {
  margin: .625rem 0 0;
  font-size: .875rem;
  font-weight: 600;
  color: var(--accent);
  text-align: center;
  min-height: 1.25rem;
}

.status:empty { display: none; }

.share-url {
  margin: .5rem 0 0;
  padding: .5rem .625rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--box-bg);
  color: var(--muted);
  font-family: ui-monospace, Menlo, monospace;
  font-size: .75rem;
  line-height: 1.4;
  word-break: break-all;
  user-select: all;
  -webkit-user-select: all;
}

/* --- a bit more room on bigger screens ------------------------ */

@media (min-width: 24rem) {
  :root { --box-w: 3.875rem; --box-h: 4rem; }
  .match__teams { font-size: 1.0625rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
