:root {
  --background: #f6f3ec;
  --surface: #ffffff;
  --text: #1d1f1c;
  --muted: #5d625b;
  --accent: #1f6f4a;
  --accent-text: #ffffff;
  --card: #ffffff;
  --card-border: #d9d4c7;
  --red: #c22f2f;
  --black: #1d1f1c;
  --shared: #f2c94c;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #0f1712;
    --surface: #17221b;
    --text: #e9ece6;
    --muted: #9aa597;
    --accent: #3fb07a;
    --accent-text: #0f1712;
    --card: #f4f1ea;
    --card-border: #2b3a30;
    --red: #c22f2f;
    --black: #1d1f1c;
    --shared: #f2c94c;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
}

main {
  max-width: 860px;
  margin: 0 auto;
  padding: 48px 16px 96px;
}

h1 {
  font-size: clamp(2rem, 6vw, 3.2rem);
  line-height: 1.1;
  margin: 0 0 16px;
}

h2 {
  margin: 0 0 12px;
}

section {
  margin-top: 56px;
}

.eyebrow {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.05em;
  margin: 0 0 8px;
}

.lede {
  color: var(--muted);
  font-size: 1.1rem;
}

.big-number {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

button {
  font: inherit;
  font-weight: 600;
  border-radius: 999px;
  padding: 10px 22px;
  cursor: pointer;
  border: 2px solid var(--accent);
}

button.primary {
  background: var(--accent);
  color: var(--accent-text);
}

button.secondary {
  background: transparent;
  color: var(--accent);
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.status {
  min-height: 1.6em;
  font-weight: 600;
}

/* The dealt deck */

.deck {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 6px;
}

.card {
  aspect-ratio: 5 / 7;
  background: var(--card);
  color: var(--black);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  line-height: 1.1;
  animation: deal 300ms ease-out both;
}

.card.red {
  color: var(--red);
}

.card.shared {
  outline: 3px solid var(--shared);
  outline-offset: 1px;
}

@keyframes deal {
  from {
    opacity: 0;
    transform: translateY(-12px) rotate(-8deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .card {
    animation: none;
  }
}

.details {
  margin-top: 24px;
  padding: 20px;
  background: var(--surface);
  border-radius: 12px;
}

.details p {
  margin: 0 0 8px;
}

.deck-number {
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.closest,
.views,
.totals,
.note,
.rising {
  color: var(--muted);
}

/* The riffle playground */

.riffle-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.strips small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 6px;
}

.strip {
  display: flex;
  height: 22px;
  border-radius: 4px;
  overflow: hidden;
}

.strip span {
  flex: 1;
}

/* Lets the wide table scroll sideways on phones instead of the whole page. */
.table-scroll {
  overflow-x: auto;
}

.distance {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  text-align: center;
  margin-top: 16px;
}

.distance caption {
  text-align: left;
  color: var(--muted);
  margin-bottom: 6px;
}

.distance th,
.distance td {
  padding: 6px 2px;
  border-bottom: 1px solid var(--card-border);
}

.distance td.current {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}
