:root {
  color-scheme: light;
  font-family: ui-rounded, "Avenir Next", "Segoe UI", system-ui, sans-serif;
  color: #1f2c28;
  background: #eee3d2;
  font-synthesis: none;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  min-width: 300px;
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: clamp(14px, 4vw, 36px);
  background:
    radial-gradient(circle at 16% 18%, rgba(255,255,255,.72) 0 2px, transparent 3px),
    radial-gradient(circle at 85% 76%, rgba(83,63,42,.10) 0 1px, transparent 2px),
    radial-gradient(circle at 50% 5%, #fffaf0 0, #f1e8d9 48%, #decdb5 100%);
  background-size: 34px 34px, 29px 29px, auto;
}

button { font: inherit; }

.game-shell {
  width: min(100%, 720px);
  overflow: hidden;
  border: 1px solid rgba(49, 57, 53, .14);
  border-radius: clamp(22px, 4vw, 34px);
  background: rgba(255, 252, 246, .96);
  box-shadow: 0 30px 80px rgba(65, 48, 29, .18), 0 2px 8px rgba(65, 48, 29, .08);
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: clamp(22px, 5vw, 34px) clamp(22px, 5vw, 38px) 22px;
}

.kicker {
  margin: 0 0 3px;
  color: #66736e;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 7vw, 52px);
  line-height: .98;
  letter-spacing: -.055em;
}

.mode {
  flex: none;
  padding: 9px 13px;
  border-radius: 999px;
  background: #dcece5;
  color: #285248;
  font-size: 13px;
  font-weight: 800;
}

.board {
  position: relative;
  margin: 0 clamp(14px, 3vw, 22px);
  min-height: 340px;
  display: grid;
  place-items: center;
  align-content: center;
  padding: clamp(28px, 7vw, 52px) 20px 34px;
  overflow: hidden;
  border-radius: 25px;
  color: #fffdf8;
  text-align: center;
  background:
    radial-gradient(circle at 50% -20%, rgba(255,255,255,.13), transparent 46%),
    linear-gradient(155deg, #31594f, #1e3d36);
  box-shadow: inset 0 1px rgba(255,255,255,.16), inset 0 -16px 45px rgba(5,25,19,.16);
}

.board::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .18;
  background-image: radial-gradient(circle, #fff 0 1px, transparent 1.5px);
  background-size: 23px 23px;
}

.turn-copy, .pebbles, .count { position: relative; z-index: 1; }

.eyebrow {
  margin: 0 0 5px;
  color: #c6ddd6;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h2 {
  margin: 0;
  font-size: clamp(26px, 5vw, 38px);
  letter-spacing: -.025em;
}

.pebbles {
  min-height: 116px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(7px, 2.1vw, 16px);
  width: 100%;
  padding: 26px 0 12px;
}

.pebble {
  width: clamp(40px, 9.5vw, 66px);
  aspect-ratio: 1.08;
  border-radius: 54% 46% 47% 53% / 48% 57% 43% 52%;
  background: linear-gradient(145deg, #fff9ed 4%, #d3c5b3 55%, #a59582);
  box-shadow:
    inset 9px 8px 16px rgba(255,255,255,.64),
    inset -8px -8px 14px rgba(68,53,39,.22),
    0 11px 18px rgba(4,23,17,.28);
  transform: rotate(var(--tilt)) translateY(var(--lift));
  animation: arrive .32s both;
  animation-delay: calc(var(--index) * 45ms);
}

@keyframes arrive {
  from { opacity: 0; transform: rotate(var(--tilt)) translateY(14px) scale(.84); }
}

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

.count {
  margin: 3px 0 0;
  color: #c9ded7;
  font-size: 15px;
  font-weight: 700;
}

.count strong {
  color: white;
  font-size: 21px;
}

.live-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
  padding: 20px clamp(14px, 3vw, 22px) 18px;
}

.take-button, .restart-button {
  min-height: 68px;
  border: 0;
  border-radius: 19px;
  font-weight: 850;
  cursor: pointer;
  transition: transform .14s ease, filter .14s ease, box-shadow .14s ease;
}

.take-button {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 11px;
  color: white;
}

.take-one {
  background: #dd6347;
  box-shadow: 0 7px 0 #a84331;
}

.take-two {
  color: #27312e;
  background: #edbd50;
  box-shadow: 0 7px 0 #b98924;
}

.button-mark {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 50%;
  background: rgba(255,255,255,.20);
  font-family: Georgia, serif;
}

.take-two .button-mark { background: rgba(39,49,46,.11); }

.take-button:hover:not(:disabled), .restart-button:hover { filter: brightness(1.045); transform: translateY(-1px); }
.take-button:active:not(:disabled), .restart-button:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(50,40,30,.45); }
.take-button:focus-visible, .restart-button:focus-visible { outline: 4px solid #285348; outline-offset: 4px; }
.take-button:disabled { cursor: not-allowed; filter: saturate(.25); opacity: .48; box-shadow: 0 4px 0 #8b847a; }

.restart-button {
  grid-column: 1 / -1;
  color: white;
  background: #dd6347;
  box-shadow: 0 7px 0 #a84331;
}

.game-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 22px;
  padding: 4px clamp(22px, 5vw, 38px) 28px;
  color: #66736e;
  font-size: 14px;
}

.game-footer p { margin: 0; }

.players {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.players li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 750;
}

.players span {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border: 1px solid #c8c3b8;
  border-radius: 50%;
}

.players .active {
  color: #21493f;
  background: #e4f0eb;
}

.players .active span {
  border-color: #2d5b50;
  color: white;
  background: #2d5b50;
}

.game-shell.won .board {
  background:
    radial-gradient(circle at 50% 15%, rgba(255,239,169,.2), transparent 42%),
    linear-gradient(155deg, #31594f, #1e3d36);
}

.game-shell.won .pebbles::after {
  content: "✦";
  color: #edbd50;
  font-size: 64px;
  line-height: 1;
  text-shadow: -54px 18px 0 rgba(237,189,80,.4), 54px -11px 0 rgba(237,189,80,.5);
}

@media (max-width: 560px) {
  body { padding: 10px; place-items: start center; }
  .game-shell { margin-top: 8px; }
  .game-header { align-items: flex-start; }
  .mode { font-size: 0; }
  .mode::after { content: "2 spelers"; font-size: 12px; }
  .board { min-height: 305px; }
  .game-footer { align-items: flex-start; flex-direction: column; }
  .players { width: 100%; }
  .players li { flex: 1; justify-content: center; }
}
