/* ▼ 全体レイアウト */
body {
  font-family: sans-serif;
  padding: 20px;
  max-width: 600px;
  margin: auto;
}

/* ▼ スマホでは左右の余白を広げる */
@media (max-width: 600px) {
  body {
    max-width: 100%;
    padding: 16px;
  }
}

/* ▼ X/Y/Z 入力パネル（PC＝3列 / スマホ＝1列） */
.xyz-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.xyz-item label {
  display: block;
  margin-bottom: 4px;
  font-weight: bold;
}

.xyz-item input {
  width: 100%;
  padding: 6px;
  font-size: 16px;
}

/* スマホは1列 */
@media (max-width: 600px) {
  .xyz-grid {
    grid-template-columns: 1fr;
  }
}

/* ▼ ご希望枚数（PC＝2列 / スマホ＝1列） */
.counts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
  margin-bottom: 20px;
}

.counts-grid label {
  display: block;
  font-weight: bold;
  margin-bottom: 4px;
}

.counts-grid input {
  width: 100%;
  padding: 6px;
  font-size: 16px;
}

/* スマホは1列 */
@media (max-width: 600px) {
  .counts-grid {
    grid-template-columns: 1fr;
  }
}

/* ▼ 読取りパネル（スマホでズレない等幅フォント） */
#tableInput {
  width: 100%;
  height: 90px;
  font-family: monospace;
}

@media (max-width: 600px) {
  #tableInput {
    height: 200px;
  }
}

#kikuPopup {
  position: absolute;
  top: 0;                 /* ← ここを 0 にする */
  left: 100%;
  margin-left: 8px;
  transform: translateY(0); /* ← translateY(-50%) を消す */
  padding: 4px 8px;
  background: #ffefc2;
  border: 1px solid #ffb300;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: bold;
  color: #333;
  white-space: nowrap;
  display: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 10;
}

#kikuPopup::after {
  content: "";
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: transparent #ffb300 transparent transparent;
}


/* ▼ number の ▲▼ を消す（Chrome / Safari / Edge） */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ▼ number の ▲▼ を消す（Firefox） */
input[type=number] {
  -moz-appearance: textfield;
}

/* ▼ ボタン */
button {
  padding: 10px 20px;
  font-size: 1rem;
  background-color: #ff7a00;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

button:hover {
  background-color: #e86c00;
}

/* スマホはボタン幅100% */
@media (max-width: 600px) {
  button {
    width: 100%;
  }
}

/* ▼ 結果テーブル */
#result-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

#result-table th,
#result-table td {
  border: 1px solid #ccc;
  padding: 8px;
  text-align: center;
}

#result-table th {
  background: #f0f0f0;
}

/* ▼ 補足表示 */
#result {
  margin-top: 20px;
  font-size: 1rem;
  font-weight: bold;
}

#error {
  margin-top: 10px;
  color: red;
  font-weight: bold;
}

.highlight {
  background: #fff7cc;
  padding: 10px;
  border-radius: 6px;
  margin-top: 15px;
}

.pink {
  background: #ffd6e8;
  padding: 2px 4px;
  border-radius: 4px;
}

.lightpink {
  background: #FF66FF;
  padding: 2px 4px;
  border-radius: 4px;
}

.note {
  margin-top: 8px;
  padding: 8px;
  background: #eef7ff;
  border-left: 4px solid #4da3ff;
  font-size: 0.9rem;
}

/* ▼ PDF風デザイン（印刷時のみ適用） */
@media print {

  @page {
    margin: 18mm;
  }

  /* ▼ 印刷時は他の要素を完全に消す（visibility ではなく display） */
  body > * {
    display: none !important;
  }

  /* ▼ #printEstimate だけ印刷対象にする */
  #printEstimate {
    display: block !important;
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    margin: 0 auto !important;
    font-family: "Yu Gothic", sans-serif;
    font-size: 12pt;
    color: #000;
  }


  /* 全体のフォントと色 */
  #printEstimate {
    font-family: "Yu Gothic", sans-serif;
    font-size: 12pt;
    color: #000;
  }

  /* タイトル（見積書） */
  #printEstimate h2 {
    font-size: 20pt;
    margin-bottom: 25px;
    letter-spacing: 2px;
  }

  /* 上段テーブル（宛名・日付・番号） */
  #printEstimate table:first-of-type td {
    padding: 4px 0;
    font-size: 10pt;
  }

/* 会社情報（右寄せ・行間を最大限詰める） */
#printEstimate table:nth-of-type(2) td {
  text-align: right;
  font-size: 11pt;
  line-height: 1.1;   /* 行間ほぼゼロ */
  padding: 0;         /* 上下の余白ゼロ */
  margin: 0;
}


  /* 明細表（太枠・PDF風） */
  #printEstimate table[border] {
    border: 2px solid #000;
  }
  #printEstimate table[border] th {
    background: #e6e6e6;
    border: 1px solid #000;
    font-size: 11pt;
    padding: 6px;
  }
  #printEstimate table[border] td {
    border: 1px solid #000;
    padding: 6px;
    font-size: 11pt;
  }

  /* 備考欄 */
  #printEstimate #p_biko {
    border: 1px solid #000 !important;
    padding: 10px;
    min-height: 80px;
    font-size: 11pt;
  }

  /* 注意書き */
  #printEstimate div[style*="font-size:0.9rem"] {
    margin-top: 15px;
    font-size: 10pt !important;
    color: #333 !important;
  }
}
