body {
  background: none;
}

/* A4印刷用スタイル */
.print-page {
  width: 100%;
  min-height: 100vh;
  background: white;
  padding: 0;
  margin: 0;
  position: relative;
}

/* 印刷ボタン */
.print-button {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  background: #007cba;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 5px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: background-color 0.3s ease;
}

.print-button:hover {
  background: #005a87;
}

.print-button:active {
  transform: translateY(1px);
}

.print-container {
  width: 100%;
  max-width: 210mm;
  /* A4幅 */
  margin: 0 auto;
  padding: 5mm;
  box-sizing: border-box;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  /* grid-template-rows: repeat(5, auto); */
  gap: 2mm 1mm;
  /* 縦2mm、横1mmの間隔 */
  width: 100%;
  height: 100%;
}

.card-item {
  display: flex;
  flex-direction: column;
  gap: 1mm;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 25mm;
  /* 最小高さを設定 */
  background: white;
  box-sizing: border-box;
  position: relative;
}

.card-image {
  width: 100%;
  height: 28mm;
  /* 画像の高さを大きく */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-image img {
  width: auto;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.kimariji-input {
  font-size: 10px;
  font-family: 'Hiragino Sans', 'ヒラギノ角ゴシック', 'Yu Gothic', '游ゴシック', sans-serif;
  color: #333;
  text-align: center;
  line-height: 1.2;
  padding: 0.8mm 0;
  width: 100%;
  min-height: 4mm;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 上下のシャッフル用クラス */
.card-item.front .card-image {
  transform: rotate(0deg);
}

.card-item.back .card-image {
  transform: rotate(180deg);
}

/* 印刷時のスタイル */
@media print {
  .print-page {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: white;
  }

  /* 印刷ボタンを非表示 */
  .print-button {
    display: none !important;
  }

  .print-container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 3mm;
    box-sizing: border-box;
  }

  .cards-grid {
    gap: 1mm 0.5mm; /* 印刷時は間隔を最小限に */
  }

  .card-item {
    min-height: 22mm;
  }

  .card-image {
    /* height: 28mm; */
  }

  .kimariji-input {
    font-size: 8px;
    min-height: 3mm;
  }

  /* ページ区切りを削除 */
}

/* 画面表示時の調整 */
@media screen {
  .print-page {
    background: #f5f5f5;
    padding: 20px 0;
    min-height: 100vh;
  }

  .print-container {
    background: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 5px;
  }

  .card-item {
    /* ボーダーなし */
  }
}

/* スマホ表示時の調整 */
@media screen and (max-width: 768px) {
  .print-page {
    background: white;
    padding: 10px 0;
  }

  .print-container {
    background: white;
    box-shadow: none;
    border-radius: 0;
    padding: 2mm;
  }

  .cards-grid {
    gap: 1mm 0.5mm;
  }

  .card-item {
    min-height: 20mm;
  }

  .card-image {
    height: 16mm;
  }

  .kimariji-input {
    font-size: 8px;
    min-height: 3mm;
  }
}