* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Arial', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  width: 375px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 10px;
  color: white;
  overflow-x: hidden;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.game-container {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 15px;
  box-shadow: 0 4px 20px rgba(31, 38, 135, 0.37);
  border: 1px solid rgba(255, 255, 255, 0.18);
  max-width: 355px;
  margin: 0 auto;
}

h1 {
  text-align: center;
  margin-bottom: 15px;
  font-size: 1.8em;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.game-info {
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin-bottom: 10px;
  font-size: 1em;
}

.score {
  background: rgba(255, 255, 255, 0.2);
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: bold;
  min-width: 60px;
  text-align: center;
}

.current-player {
  font-weight: bold;
  background: rgba(255, 255, 255, 0.3);
  padding: 8px 12px;
  border-radius: 8px;
  text-align: center;
  margin-bottom: 15px;
  font-size: 0.9em;
}

.dice-section {
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin: 15px 0;
  gap: 10px;
}

.dice-container {
  background: rgba(255, 255, 255, 0.2);
  padding: 10px;
  border-radius: 12px;
  text-align: center;
  flex: 1;
}

.dice-label {
  font-size: 0.8em;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.9);
}

.dice {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #f8f8f8 0%, #e8e8e8 100%);
  border: 2px solid #333;
  border-radius: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  gap: 1px;
  padding: 6px;
  margin: 0 auto;
  box-shadow: 
      0 4px 8px rgba(0,0,0,0.3),
      inset 0 1px 0 rgba(255,255,255,0.6);
  transition: all 0.2s ease;
  cursor: pointer;
  touch-action: manipulation;
}

.dice:active {
  transform: scale(0.95);
}

.dice.rolling {
  animation: roll3d 1s ease-in-out;
}

@keyframes roll3d {
  0% { transform: rotateX(0deg) rotateY(0deg); }
  25% { transform: rotateX(90deg) rotateY(90deg); }
  50% { transform: rotateX(180deg) rotateY(180deg); }
  75% { transform: rotateX(270deg) rotateY(270deg); }
  100% { transform: rotateX(360deg) rotateY(360deg); }
}

.dot {
  width: 6px;
  height: 6px;
  background: #333;
  border-radius: 50%;
  margin: auto;
}

.dice.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dice.disabled:active {
  transform: none;
}

.board {
  display: grid;
  grid-template-columns: repeat(4, 70px);
  grid-template-rows: repeat(4, 70px);
  gap: 2px;
  background: #2d5016;
  padding: 10px;
  border-radius: 10px;
  margin: 15px auto;
  justify-content: center;
  max-width: 300px;
}

.cell {
  width: 70px;
  height: 70px;
  background: #4a7c59;
  border: 1px solid #2d5016;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  touch-action: manipulation;
}

.cell:active {
  background: #5a8c69;
  transform: scale(0.95);
}

.cell.valid-move {
  background: #6a9c79;
  box-shadow: inset 0 0 8px rgba(255, 255, 0, 0.4);
}

.cell.valid-move:active {
  background: #7aac89;
}

.piece {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.black {
  background: radial-gradient(circle at 30% 30%, #4a4a4a, #000);
}

.white {
  background: radial-gradient(circle at 30% 30%, #fff, #ddd);
}

.controls {
  text-align: center;
  margin: 15px 0;
  display: flex;
  justify-content: space-around;
  gap: 10px;
}

button {
  background: linear-gradient(45deg, #ff6b6b, #ee5a24);
  color: white;
  border: none;
  padding: 12px 20px;
  font-size: 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 3px 10px rgba(0,0,0,0.2);
  flex: 1;
  max-width: 120px;
  touch-action: manipulation;
  font-weight: bold;
}

button:active {
  transform: translateY(1px);
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.game-over {
  text-align: center;
  font-size: 1.2em;
  margin-top: 15px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  line-height: 1.4;
}

.game-over h2 {
  margin-bottom: 10px;
  font-size: 1.3em;
}

.game-over p {
  margin: 5px 0;
  font-size: 0.9em;
}

.rules {
  margin-top: 15px;
  background: rgba(255, 255, 255, 0.1);
  padding: 15px;
  border-radius: 10px;
  font-size: 0.85em;
  line-height: 1.4;
}

.rules h3 {
  margin-bottom: 10px;
  font-size: 1.1em;
}

.rules p {
  margin: 8px 0;
}

/* タッチデバイス用の調整 */
@media (max-height: 700px) {
  .game-container {
      padding: 10px;
  }
  
  h1 {
      font-size: 1.6em;
      margin-bottom: 10px;
  }
  
  .board {
      margin: 10px auto;
  }
  
  .dice-section {
      margin: 10px 0;
  }
}

/* 非常に小さい画面用 */
@media (max-height: 600px) {
  .cell {
      width: 60px;
      height: 60px;
  }
  
  .board {
      grid-template-columns: repeat(4, 60px);
      grid-template-rows: repeat(4, 60px);
  }
  
  .piece {
      width: 50px;
      height: 50px;
  }
  
  .dice {
      width: 45px;
      height: 45px;
  }
}