:root {
  --font-main: 'M PLUS Rounded 1c', 'BIZ UDPGothic', sans-serif;
}

body {
  font-family: var(--font-main);
  background-color: #f8fafc;
  color: #1e293b;
  user-select: none;
  -webkit-user-select: none;
}

/* 数字グリッドのセルアニメーション・スタイル */
.number-cell {
  aspect-ratio: 1 / 1;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 0 #cbd5e1;
}

.number-cell:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #cbd5e1;
}

/* 正解済みのマス */
.number-cell.cleared {
  background-color: #d1fae5 !important;
  border-color: #34d399 !important;
  color: #059669 !important;
  box-shadow: 0 2px 0 #a7f3d0 !important;
  transform: translateY(2px);
}

/* 間違えた時のシェイクアニメーション */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); background-color: #fee2e2; border-color: #f87171; }
  75% { transform: translateX(6px); background-color: #fee2e2; border-color: #f87171; }
}
.shake-error {
  animation: shake 0.28s ease-in-out;
}

/* ポップなボタン装飾 */
.btn-pop {
  transition: all 0.15s ease;
}
.btn-pop:active {
  transform: translateY(3px);
}

/* モード切替タブ */
.mode-tab.active {
  background-color: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 4px 0 #0369a1;
}

/* 運筆・迷路キャンバス */
#trace-canvas {
  touch-action: none;
  cursor: crosshair;
}

/* 印刷専用スタイル（A4 1枚に綺麗に収める） */
@media print {
  @page {
    size: A4 portrait;
    margin: 12mm;
  }
  body {
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .no-print {
    display: none !important;
  }
  .print-only {
    display: block !important;
  }
  .print-container {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  #grid-container {
    max-width: 165mm !important;
    margin: 8mm auto !important;
    gap: 3.5mm !important;
  }
  #canvas-wrapper {
    max-width: 170mm !important;
    margin: 6mm auto !important;
    border: 2.5px solid #000000 !important;
    box-shadow: none !important;
  }
  .number-cell {
    background-color: #ffffff !important;
    color: #000000 !important;
    border: 2.5px solid #000000 !important;
    box-shadow: none !important;
    border-radius: 10px !important;
    transform: none !important;
  }
  /* A4印刷時の最下部に控えめなグレー文字でサイト名を印字 */
  .print-container::after {
    content: "にこまるプリント | gb-nikomaru.com";
    display: block;
    text-align: center;
    font-size: 10px;
    color: #9ca3af !important;
    margin-top: 3mm;
    letter-spacing: 0.04em;
  }
}
