html {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}

body {
  background: linear-gradient(135deg, #f6f0cc 0%, #fff8dc 100%) !important;
  font-family: UD Digi Kyokasho NK-B, "ヒラギノ丸ゴ ProN W4", "ヒラギノ角ゴ ProN";
  padding: 0.5rem;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  margin: 0;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.kigo {
  background-color: white;
  border-radius: 10%;
  box-shadow: 4px 4px 0 gray;
  margin: 2px;
  padding: 3px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 55px;
  min-height: 55px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kigo img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.kigo:hover {
  -webkit-transform: translate(0, 0.25rem);
  transform: translate(0, 0.25rem);
  background-color: lightsalmon;
}

.kigo:active {
  -webkit-transform: translate(0, 0.5rem);
  transform: translate(0, 0.5rem);
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  body {
    padding: 0.25rem;
    background: linear-gradient(135deg, #f6f0cc 0%, #fff8dc 100%);
  }

  .container {
    padding: 0 0.5rem;
  }

  h1 {
    font-size: 1.5rem !important;
  }

  h5 {
    font-size: 1rem !important;
  }

  .btn {
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
    margin: 0.25rem !important;
  }

  .table {
    font-size: 0.875rem;
  }

  .table td {
    padding: 0.5rem !important;
  }

  .h2 {
    font-size: 1.25rem !important;
  }

  .h3 {
    font-size: 1.1rem !important;
  }

  .h5 {
    font-size: 0.875rem !important;
  }

  .kigo {
    min-width: 45px;
    min-height: 45px;
    margin: 1px;
    padding: 2px;
  }
}

@media (max-width: 480px) {
  body {
    background: linear-gradient(135deg, #f6f0cc 0%, #fff8dc 100%);
  }

  h1 {
    font-size: 1.25rem !important;
    margin-top: 1rem !important;
  }

  .btn {
    padding: 0.25rem 0.375rem;
    font-size: 0.75rem;
    margin: 0.125rem !important;
  }

  .table {
    font-size: 0.75rem;
  }

  .table td {
    padding: 0.25rem !important;
  }

  .h2 {
    font-size: 1.1rem !important;
  }

  .h3 {
    font-size: 1rem !important;
  }

  .kigo {
    min-width: 40px;
    min-height: 40px;
  }

  /* テーブルを横スクロール可能にする */
  .table-responsive {
    overflow-x: auto;
  }
}

/* 色弱対応とアクセシビリティ改善 */
.btn-primary {
  background-color: #0d6efd;
  border-color: #0d6efd;
  font-weight: bold;
}

.btn-danger {
  background-color: #dc3545;
  border-color: #dc3545;
  font-weight: bold;
}

.btn:focus, .btn:active:focus {
  outline: 3px solid #ffc107;
  outline-offset: 2px;
}

.kigo:focus {
  outline: 3px solid #ffc107;
  outline-offset: 2px;
}

/* 正解・不正解の視覚的フィードバック強化 */
.kigo.correct {
  background-color: #d4edda;
  border: 3px solid #28a745;
  animation: correctPulse 0.6s ease-in-out;
}

.kigo.incorrect {
  background-color: #f8d7da;
  border: 3px solid #dc3545;
  animation: incorrectShake 0.5s ease-in-out;
}

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

@keyframes incorrectShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* 正解時の背景演出 */
.correct-background {
  background: linear-gradient(45deg, #28a745, #20c997, #17a2b8, #28a745);
  background-size: 400% 400%;
  animation: correctGradient 1.5s ease;
}

@keyframes correctGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* 正解時の紙吹雪エフェクト */
.confetti {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #ffd700;
  animation: confettiFall 2s linear infinite;
}

.confetti-piece:nth-child(odd) {
  background: #ff6b6b;
  animation-delay: 0.5s;
}

.confetti-piece:nth-child(3n) {
  background: #4ecdc4;
  animation-delay: 1s;
}

.confetti-piece:nth-child(4n) {
  background: #45b7d1;
  animation-delay: 1.5s;
}

.confetti-piece:nth-child(5n) {
  background: #96ceb4;
  animation-delay: 0.8s;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* 正解時のフラッシュエフェクト */
.success-flash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(40, 167, 69, 0.3);
  pointer-events: none;
  z-index: 1000;
  animation: successFlash 0.5s ease-out;
}

@keyframes successFlash {
  0% { opacity: 0; }
  50% { opacity: 1; }
  100% { opacity: 0; }
}

/* フレンドリーなデザイン要素 */

.card-style {
  background: white;
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  margin: 1rem 0;
}

.fun-button {
  border-radius: 25px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  font-weight: bold;
  text-transform: none;
}

.fun-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

/* 成功メッセージのスタイル */
.success-message {
  background: linear-gradient(45deg, #28a745, #20c997);
  color: white;
  padding: 1rem;
  border-radius: 10px;
  text-align: center;
  font-weight: bold;
  margin: 1rem 0;
  animation: slideIn 0.5s ease-out;
}

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

/* 高コントラスト対応 */
@media (prefers-contrast: high) {
  .kigo {
    border: 2px solid #000;
  }

  .btn {
    border: 2px solid #000;
  }

  .table {
    border: 2px solid #000;
  }
}

