/* =====================================
   基本設定・フォント・リセット
===================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'M PLUS Rounded 1c', sans-serif;
  background: linear-gradient(135deg, #f8f9fa 0%, #e3f2fd 100%);
  min-height: 100vh;
  padding: 20px;
  color: #2c3e50;
  position: relative;
}

/* 方眼ノート風背景 */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
      linear-gradient(rgba(0,0,0,0.03) 1px, transparent 1px),
      linear-gradient(90deg, rgba(0,0,0,0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
  z-index: -1;
}

/* =====================================
 メインコンテナ
===================================== */
.game-container {
  max-width: 1400px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  padding: 30px;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(52, 152, 219, 0.1);
}

/* =====================================
 ヘッダー
===================================== */
.game-header {
  text-align: center;
  margin-bottom: 30px;
  padding: 20px;
  background: linear-gradient(135deg, #3498db, #2980b9);
  border-radius: 12px;
  color: white;
  box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

.game-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
  font-size: 1.2rem;
  opacity: 0.9;
  font-weight: 400;
}

/* =====================================
 ゲーム情報パネル
===================================== */
.game-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
}

.player-info, .cpu-info {
  background: linear-gradient(135deg, #ffffff, #f8f9fa);
  padding: 20px;
  border-radius: 12px;
  border: 2px solid #e3f2fd;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.player-info:hover, .cpu-info:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.player-info h3, .cpu-info h3 {
  font-size: 1.5rem;
  margin-bottom: 15px;
  color: #2c3e50;
}

.money-display, .position-display {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.money-label, .position-label {
  font-weight: 600;
  margin-right: 10px;
  color: #34495e;
}

.money-amount {
  font-weight: 700;
  font-size: 1.3rem;
  color: #27ae60;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.money-unit {
  margin-left: 5px;
  color: #7f8c8d;
}

.position-value {
  font-weight: 600;
  color: #3498db;
}

/* =====================================
 フェーズインジケーター
===================================== */
.phase-indicators {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 25px;
}

.phase-indicator {
  padding: 15px;
  border-radius: 10px;
  text-align: center;
  font-weight: 600;
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

.phase-indicator.childhood {
  background: linear-gradient(135deg, #ffeb3b, #ffc107);
  border-color: #ff9800;
  color: #bf360c;
}

.phase-indicator.school {
  background: linear-gradient(135deg, #4caf50, #388e3c);
  border-color: #2e7d32;
  color: white;
}

.phase-indicator.work {
  background: linear-gradient(135deg, #9c27b0, #7b1fa2);
  border-color: #6a1b9a;
  color: white;
}

.phase-icon {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 5px;
}

.phase-name {
  display: block;
  font-size: 1rem;
  margin-bottom: 3px;
}

.phase-range {
  font-size: 0.8rem;
  opacity: 0.8;
}

/* =====================================
 ゲーム盤面
===================================== */
.game-board {
  background: rgba(255, 255, 255, 0.8);
  border-radius: 15px;
  padding: 25px;
  margin-bottom: 30px;
  border: 3px solid #3498db;
  box-shadow: inset 0 0 20px rgba(52, 152, 219, 0.1);
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 8px;
  max-width: 100%;
}

/* =====================================
 マススタイル
===================================== */
.square {
  aspect-ratio: 1;
  border: 2px solid #34495e;
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: all 0.3s ease;
  cursor: pointer;
  background: white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.square:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

/* スタート・ゴールマス */
.start-square {
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  color: white;
  border-color: #1e8449;
  font-weight: 700;
}

.goal-square {
  background: linear-gradient(135deg, #f39c12, #e67e22);
  color: white;
  border-color: #d35400;
  font-weight: 700;
}

/* 幼少期マス */
.childhood-square {
  background: linear-gradient(135deg, #fff9c4, #fff59d);
  border-color: #ff9800;
  color: #bf360c;
}

/* 学校編マス */
.school-square {
  background: linear-gradient(135deg, #c8e6c9, #a5d6a7);
  border-color: #4caf50;
  color: #1b5e20;
}

/* 社会人編マス */
.work-square {
  background: linear-gradient(135deg, #e1bee7, #ce93d8);
  border-color: #9c27b0;
  color: #4a148c;
}

/* =====================================
 マス内要素
===================================== */
.square-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
  font-weight: 700;
}

.square-number {
  font-size: 0.8rem;
  background: rgba(0, 0, 0, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  min-width: 25px;
  text-align: center;
}

.square-icon {
  font-size: 1.2rem;
}

.square-content {
  flex-grow: 1;
  text-align: center;
}

.square-title {
  font-weight: 600;
  font-size: 0.7rem;
  margin-bottom: 3px;
  line-height: 1.2;
}

.square-description {
  font-size: 0.6rem;
  line-height: 1.1;
  margin-bottom: 3px;
  opacity: 0.8;
}

.square-effect {
  font-weight: 700;
  font-size: 0.7rem;
  padding: 2px 4px;
  border-radius: 3px;
  margin-top: 3px;
}

.childhood-square .square-effect,
.school-square .square-effect,
.work-square .square-effect {
  background: rgba(255, 255, 255, 0.7);
}

.start-square .square-effect,
.goal-square .square-effect {
  background: rgba(255, 255, 255, 0.3);
}

/* プラス効果 */
.square-effect:contains('+') {
  color: #2e7d32;
}

/* マイナス効果 */
.square-effect:contains('-') {
  color: #d32f2f;
}

/* =====================================
 プレイヤートークン
===================================== */
.player-tokens {
  display: flex;
  justify-content: center;
  gap: 3px;
  margin-top: 5px;
}

.token {
  font-size: 1rem;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.player-token {
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
  border: 2px solid white;
}

.cpu-token {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
  border: 2px solid white;
}

.token:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* =====================================
 ゲームコントロール
===================================== */
.game-controls {
  background: linear-gradient(135deg, #ecf0f1, #bdc3c7);
  padding: 25px;
  border-radius: 12px;
  margin-bottom: 25px;
  border: 2px solid #95a5a6;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  align-items: center;
}

.dice-section {
  text-align: center;
}

.dice {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #ffffff, #f8f9fa);
  border: 3px solid #34495e;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 15px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  cursor: pointer;
}

.dice:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

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

@keyframes diceRoll {
  0% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(90deg) scale(1.1); }
  50% { transform: rotate(180deg) scale(1.2); }
  75% { transform: rotate(270deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}

.dice-face {
  font-size: 2.5rem;
  transition: all 0.2s ease;
}

.dice-button {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
  font-family: inherit;
}

.dice-button:hover {
  background: linear-gradient(135deg, #c0392b, #a93226);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.dice-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.dice-button:disabled {
  background: #95a5a6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.dice-result {
  margin-top: 10px;
  font-weight: 600;
  font-size: 1.1rem;
  color: #2c3e50;
}

.turn-indicator {
  text-align: center;
}

.current-turn {
  font-size: 1.3rem;
  font-weight: 700;
  color: #2c3e50;
  padding: 15px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  border: 2px solid #3498db;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.game-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.game-button {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.reset-button {
  background: linear-gradient(135deg, #95a5a6, #7f8c8d);
  color: white;
  box-shadow: 0 4px 12px rgba(149, 165, 166, 0.3);
}

.reset-button:hover {
  background: linear-gradient(135deg, #7f8c8d, #6c7b7d);
  transform: translateY(-2px);
}

.auto-button {
  background: linear-gradient(135deg, #f39c12, #e67e22);
  color: white;
  box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
}

.auto-button:hover {
  background: linear-gradient(135deg, #e67e22, #d35400);
  transform: translateY(-2px);
}

/* =====================================
 イベントログ
===================================== */
.event-log {
  background: linear-gradient(135deg, #2c3e50, #34495e);
  color: white;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 25px;
  box-shadow: 0 6px 15px rgba(44, 62, 80, 0.3);
}

.event-log h3 {
  margin-bottom: 15px;
  font-size: 1.3rem;
  color: #ecf0f1;
}

.log-content {
  max-height: 200px;
  overflow-y: auto;
  padding-right: 10px;
}

.log-content::-webkit-scrollbar {
  width: 8px;
}

.log-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.log-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

.log-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

.log-entry {
  padding: 8px 12px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  border-left: 4px solid #3498db;
  font-size: 0.9rem;
  line-height: 1.4;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
      opacity: 0;
      transform: translateX(-20px);
  }
  to {
      opacity: 1;
      transform: translateX(0);
  }
}

.log-entry.player-action {
  border-left-color: #3498db;
}

.log-entry.cpu-action {
  border-left-color: #e74c3c;
}

.log-entry.game-event {
  border-left-color: #f39c12;
}

/* =====================================
 ゲーム結果
===================================== */
.game-result {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.result-content {
  background: linear-gradient(135deg, #ffffff, #f8f9fa);
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  border: 3px solid #3498db;
  max-width: 500px;
  width: 90%;
  animation: resultAppear 0.5s ease;
}

@keyframes resultAppear {
  from {
      opacity: 0;
      transform: scale(0.8) translateY(-50px);
  }
  to {
      opacity: 1;
      transform: scale(1) translateY(0);
  }
}

.result-content h2 {
  font-size: 2.5rem;
  margin-bottom: 30px;
  color: #2c3e50;
}

.final-scores {
  display: flex;
  justify-content: space-around;
  margin-bottom: 30px;
}

.score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  background: rgba(52, 152, 219, 0.1);
  border-radius: 12px;
  border: 2px solid #3498db;
}

.score-label {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: #2c3e50;
}

.score-value {
  font-size: 2rem;
  font-weight: 700;
  color: #27ae60;
}

.winner-announcement {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 30px;
  padding: 15px;
  border-radius: 10px;
  animation: glow 2s infinite;
}

.winner-announcement.player-wins {
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  color: white;
}

.winner-announcement.cpu-wins {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
}

.winner-announcement.tie {
  background: linear-gradient(135deg, #f39c12, #e67e22);
  color: white;
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px rgba(52, 152, 219, 0.3); }
  50% { box-shadow: 0 0 30px rgba(52, 152, 219, 0.6); }
}

.restart-button {
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 10px;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 6px 15px rgba(52, 152, 219, 0.3);
  font-family: inherit;
}

.restart-button:hover {
  background: linear-gradient(135deg, #2980b9, #2471a3);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(52, 152, 219, 0.4);
}

/* =====================================
 レスポンシブデザイン
===================================== */
@media (max-width: 1200px) {
  .board-grid {
      grid-template-columns: repeat(8, 1fr);
  }
  
  .game-controls {
      grid-template-columns: 1fr;
      gap: 15px;
  }
}

@media (max-width: 768px) {
  .game-container {
      padding: 15px;
  }
  
  .game-header h1 {
      font-size: 2rem;
  }
  
  .game-info {
      grid-template-columns: 1fr;
  }
  
  .phase-indicators {
      grid-template-columns: 1fr;
  }
  
  .board-grid {
      grid-template-columns: repeat(5, 1fr);
      gap: 6px;
  }
  
  .square {
      padding: 6px;
  }
  
  .square-title {
      font-size: 0.6rem;
  }
  
  .square-description {
      font-size: 0.5rem;
  }
  
  .dice {
      width: 60px;
      height: 60px;
  }
  
  .dice-face {
      font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .board-grid {
      grid-template-columns: repeat(4, 1fr);
      gap: 4px;
  }
  
  .square {
      padding: 4px;
  }
  
  .square-title {
      font-size: 0.5rem;
  }
  
  .square-description {
      display: none;
  }
  
  .token {
      width: 15px;
      height: 15px;
      font-size: 0.8rem;
  }
}

/* =====================================
 特殊効果・アニメーション
===================================== */
.square.active {
  animation: highlight 0.5s ease;
  border-color: #f39c12;
  box-shadow: 0 0 20px rgba(243, 156, 18, 0.6);
}

@keyframes highlight {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.token.moving {
  animation: tokenMove 0.8s ease;
}

@keyframes tokenMove {
  0% { transform: scale(1); }
  50% { transform: scale(1.3) translateY(-10px); }
  100% { transform: scale(1); }
}

.money-amount.changing {
  animation: moneyChange 0.6s ease;
}

@keyframes moneyChange {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); color: #e74c3c; }
  100% { transform: scale(1); }
}

/* =====================================
 印刷用スタイル
===================================== */
@media print {
  body::before {
      display: none;
  }
  
  .game-controls,
  .event-log,
  .game-result {
      display: none;
  }
  
  .game-container {
      box-shadow: none;
      border: 2px solid #000;
  }
  
  .square {
      border-color: #000;
      box-shadow: none;
  }
}