:root {
  --action-blue: #0066cc;
  --action-blue-focus: #0071e3;
  --canvas: #ffffff;
  --canvas-soft: #f5f5f7;
  --felt: #124237;
  --felt-deep: #0b2a23;
  --hairline: #d8d8df;
  --ink: #1d1d1f;
  --ink-muted: #6e6e73;
  --negative: #c32121;
  --positive: #1d7f45;
  --warm: #f6e9cf;

  color-scheme: light;
  font-family: "SF Pro Text", system-ui, -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
  background: var(--canvas-soft);
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 34%, rgba(18, 66, 55, 0.18), transparent 38%),
    var(--canvas-soft);
}

button,
input {
  font: inherit;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto auto auto auto;
  gap: 14px;
  padding: 24px 30px;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 16px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1;
  font-weight: 600;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 8px;
}

.meta span {
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  padding: 8px 12px;
  font-size: 14px;
}

.table {
  align-self: stretch;
  display: grid;
  min-height: 250px;
  grid-template-rows: repeat(3, minmax(72px, 1fr));
  gap: 14px;
  border-radius: 30px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent 42%),
    var(--felt);
  padding: 18px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.lane {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 22px;
  background: rgba(11, 42, 35, 0.38);
  padding: 10px;
}

.lane p {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 600;
}

.player {
  background: rgba(255, 255, 255, 0.12);
}

.cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  min-height: 78px;
}

.card {
  width: 58px;
  height: 78px;
  display: grid;
  align-content: space-between;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  background: #ffffff;
  padding: 10px;
  color: var(--ink);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.14);
}

.card b {
  font-size: 20px;
  font-weight: 600;
}

.card small {
  color: var(--ink-muted);
  font-size: 16px;
  font-weight: 600;
}

.card.red b,
.card.red small {
  color: #d70015;
}

.card.back {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14) 25%, transparent 25%) 0 0 / 14px 14px,
    linear-gradient(135deg, transparent 75%, rgba(255, 255, 255, 0.14) 75%) 0 0 / 14px 14px,
    #1f4c98;
}

.card.placeholder {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: none;
}

.streets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.streets span {
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--canvas);
  padding: 9px 10px;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.streets .current {
  border-color: var(--action-blue);
  color: var(--action-blue);
}

.streets .done {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--ink-muted);
  font-size: 14px;
  font-weight: 600;
}

input {
  width: 190px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--canvas);
  padding: 12px 20px;
  color: var(--ink);
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: var(--action-blue);
  color: #ffffff;
  padding: 0 26px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background-color 120ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 120ms cubic-bezier(0.16, 1, 0.3, 1);
}

button:hover:not(:disabled) {
  background: var(--action-blue-focus);
}

button:active:not(:disabled) {
  transform: scale(0.96);
}

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

input:focus-visible,
button:focus-visible {
  outline: 2px solid var(--action-blue-focus);
  outline-offset: 2px;
}

.result {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--hairline);
  border-radius: 22px;
  background: var(--canvas);
  padding: 18px;
}

.result.win {
  border-color: rgba(29, 127, 69, 0.28);
  background: #f1fbf5;
}

.result.lose {
  border-color: rgba(195, 33, 33, 0.24);
  background: #fff5f4;
}

.result-copy {
  display: grid;
  gap: 7px;
}

.result strong {
  font-size: 21px;
  font-weight: 600;
}

.result span,
.error {
  color: var(--ink-muted);
  font-size: 14px;
}

.scores {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 8px;
}

.score {
  min-width: 132px;
  display: grid;
  gap: 5px;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.74);
  padding: 12px;
}

.score span {
  font-size: 12px;
}

.score strong {
  font-size: 16px;
}

.score.win {
  border-color: rgba(29, 127, 69, 0.28);
  color: var(--positive);
}

.score.lose {
  border-color: rgba(195, 33, 33, 0.24);
  color: var(--negative);
}

.muted-score {
  color: var(--ink);
}

.error {
  margin: 0;
  border-radius: 18px;
  background: #fff0f0;
  padding: 12px 14px;
  color: #d70015;
  font-weight: 600;
}

@media (max-width: 720px) {
  .shell {
    min-height: 100svh;
    grid-template-rows: auto auto auto auto auto;
    padding: 18px;
  }

  .hero,
  .result {
    display: block;
  }

  .meta,
  .scores {
    justify-content: start;
    margin-top: 16px;
  }

  h1 {
    font-size: 34px;
  }

  .table {
    min-height: 250px;
    border-radius: 24px;
    padding: 12px;
  }

  .lane {
    padding: 12px;
  }

  .cards {
    min-height: 82px;
    gap: 7px;
  }

  .card {
    width: 54px;
    height: 74px;
    border-radius: 10px;
    padding: 8px;
  }

  .card b {
    font-size: 19px;
  }

  .card small {
    font-size: 15px;
  }

  .streets {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .controls {
    display: grid;
  }

  input,
  button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  button {
    transition: none;
  }
}
