* {
  box-sizing: border-box;
}

.mancala-content {
  display: grid;
  gap: 22px;
}

.mancala-hero {
  display: grid;
  gap: 18px;
  align-items: center;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.mancala-hero h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
  color: #0b2a3d;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
}

.status {
  font-size: 1.2rem;
  font-weight: 600;
  color: #0b2a3d;
}

.meta {
  color: var(--muted);
  font-size: 0.95rem;
}

.btn {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(14, 165, 233, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 20px rgba(14, 165, 233, 0.35);
}

.board-wrap {
  display: grid;
  justify-items: center;
  width: 100%;
}

.board {
  width: 100%;
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 18px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 150px repeat(6, 1fr) 150px;
  grid-template-rows: repeat(2, auto);
  column-gap: 12px;
  row-gap: 12px;
  align-items: center;
}

.store {
  height: 100%;
  border-radius: 18px;
  background: #edf7ff;
  border: 1px solid #d7ebfb;
  color: #0b4660;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  position: relative;
  overflow: hidden;
  align-self: stretch;
  grid-row: 1 / span 2;
  padding: 12px;
  text-align: center;
  gap: 8px;
}

.store .count {
  font-size: 2rem;
}

.store-label {
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  line-height: 1.2;
  word-break: break-word;
}

.row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  grid-column: 2 / span 6;
  align-items: center;
}

.row-ai {
  grid-row: 1;
}

.row-player {
  grid-row: 2;
}

.store-left {
  grid-column: 1;
}

.store-right {
  grid-column: 8;
}

.pit {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 90px;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  cursor: pointer;
  box-shadow: inset 0 3px 8px rgba(15, 23, 42, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.count {
  font-size: inherit;
}

.pit::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 999px;
  border: 1px dashed rgba(15, 23, 42, 0.12);
}

.pit:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 4px 10px rgba(15, 23, 42, 0.12), 0 8px 16px rgba(15, 23, 42, 0.1);
}

.pit[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
  box-shadow: inset 0 3px 8px rgba(15, 23, 42, 0.08);
}

.pit.ai {
  cursor: default;
}

.pit.ai:hover {
  transform: none;
}

.pit.flash-empty {
  background: #e2e8f0;
  box-shadow: inset 0 4px 10px rgba(15, 23, 42, 0.14), 0 10px 18px rgba(148, 163, 184, 0.25);
}

.pit.flash-add {
  background: #e0f2fe;
  box-shadow: inset 0 4px 10px rgba(15, 23, 42, 0.14), 0 10px 18px rgba(59, 130, 246, 0.2);
}

.store.flash-add {
  background: #dbeafe;
  box-shadow: 0 14px 28px rgba(59, 130, 246, 0.2);
}

.rules ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 840px) {
  .board {
    grid-template-columns: 110px repeat(6, 1fr) 110px;
    gap: 8px;
    padding: 14px;
  }

  .pit {
    min-height: 64px;
    font-size: 1.3rem;
  }

  .store .count {
    font-size: 1.4rem;
  }
}

@media (max-width: 600px) {
  .board {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 10px;
  }

  .store {
    min-height: 70px;
    grid-row: auto;
    grid-column: 1;
  }

  .row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    grid-column: 1;
  }

  .pit {
    min-height: 70px;
  }
}
