/* ===== リセット & 基本 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", system-ui, sans-serif;
  background: #f0f4f0;
  color: #222;
  min-height: 100vh;
}

/* ===== ヘッダー ===== */
header {
  background: #06C755;
  color: #fff;
  text-align: center;
  padding: 18px 16px 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
header h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: .03em; }
header p  { font-size: .85rem; opacity: .9; margin-top: 4px; }

/* ===== ステップバー ===== */
.steps {
  display: flex;
  justify-content: center;
  gap: 0;
  background: #fff;
  border-bottom: 2px solid #e0e0e0;
  overflow-x: auto;
}
.step {
  flex: 1;
  min-width: 80px;
  text-align: center;
  padding: 10px 4px;
  font-size: .75rem;
  color: #aaa;
  border-bottom: 3px solid transparent;
  transition: color .2s, border-color .2s;
  white-space: nowrap;
}
.step.active { color: #06C755; border-bottom-color: #06C755; font-weight: 700; }
.step .num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: #e0e0e0; color: #888; font-size: .8rem; font-weight: 700;
  margin-bottom: 3px;
}
.step.active .num { background: #06C755; color: #fff; }

/* ===== メインコンテンツ ===== */
main {
  max-width: 900px;
  margin: 24px auto;
  padding: 0 16px 60px;
}

/* ===== セクション ===== */
.section {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.section h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section h2 .badge {
  background: #06C755;
  color: #fff;
  border-radius: 50%;
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .8rem; flex-shrink: 0;
}

/* ===== アップロードゾーン ===== */
#drop-zone {
  border: 2.5px dashed #06C755;
  border-radius: 10px;
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: background .15s;
  color: #555;
}
#drop-zone:hover, #drop-zone.drag-over { background: #e8faf0; }
#drop-zone .icon { font-size: 2.5rem; margin-bottom: 8px; }
#drop-zone p { font-size: .9rem; }
#drop-zone small { color: #888; font-size: .78rem; }
#file-input { display: none; }

/* ===== スタンプグリッド ===== */
#stamp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.stamp-card {
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
  background: #fafafa;
  display: flex;
  flex-direction: column;
}
.stamp-card .preview-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 370 / 320;
  background: repeating-conic-gradient(#e0e0e0 0% 25%, #fff 0% 50%) 0 0 / 14px 14px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.stamp-card canvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
}
.stamp-card .spinner-wrap {
  position: absolute; inset: 0;
  background: rgba(255,255,255,.75);
  display: flex; align-items: center; justify-content: center;
}
.stamp-card .card-body { padding: 10px; }
.stamp-card .card-body label { font-size: .75rem; color: #666; }
.stamp-card .card-body input[type="text"] {
  width: 100%;
  border: 1.5px solid #ccc;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: .85rem;
  margin-top: 4px;
  font-family: inherit;
}
.stamp-card .card-body input[type="text"]:focus {
  outline: none; border-color: #06C755;
}
.stamp-card .card-actions {
  display: flex; gap: 6px; margin-top: 8px;
}
.stamp-card .btn-apply-text {
  flex: 1;
  background: #06C755; color: #fff;
  border: none; border-radius: 6px;
  padding: 6px 0; font-size: .8rem; cursor: pointer;
  font-family: inherit;
}
.stamp-card .btn-apply-text:hover { background: #05a848; }
.stamp-card .btn-remove {
  background: #f5f5f5; color: #888;
  border: 1.5px solid #ddd; border-radius: 6px;
  padding: 6px 10px; font-size: .8rem; cursor: pointer;
  font-family: inherit;
}
.stamp-card .btn-remove:hover { background: #ffe0e0; color: #c00; border-color: #f9a; }

/* ===== スピナー ===== */
.spinner {
  width: 36px; height: 36px;
  border: 4px solid #e0e0e0;
  border-top-color: #06C755;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== ボタン群 ===== */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: #06C755; color: #fff;
  border: none; border-radius: 8px;
  padding: 12px 28px; font-size: 1rem; font-weight: 700;
  cursor: pointer; font-family: inherit;
  transition: background .15s;
}
.btn-primary:hover { background: #05a848; }
.btn-primary:disabled { background: #aaa; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: #fff; color: #06C755;
  border: 2px solid #06C755; border-radius: 8px;
  padding: 11px 24px; font-size: .95rem; font-weight: 700;
  cursor: pointer; font-family: inherit;
  transition: background .15s;
}
.btn-secondary:hover { background: #e8faf0; }

/* ===== 申請テキスト生成 ===== */
.gemini-section { display: flex; flex-direction: column; gap: 12px; }
.gemini-section .btn-row { display: flex; gap: 12px; flex-wrap: wrap; }
.gemini-section .note {
  font-size: .82rem; color: #666;
  background: #f5f5f5; border-radius: 6px; padding: 8px 12px;
}

/* ===== ZIPダウンロード ===== */
.download-section { text-align: center; }
.download-section .btn-primary { font-size: 1.1rem; padding: 14px 40px; }
.download-section p { margin-top: 10px; font-size: .82rem; color: #888; }

/* ===== 空状態メッセージ ===== */
#empty-message {
  text-align: center; color: #aaa;
  padding: 24px 0; font-size: .9rem;
}

/* ===== トースト ===== */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #333; color: #fff;
  padding: 10px 24px; border-radius: 24px;
  font-size: .88rem; z-index: 9999;
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
  max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; }
#toast.error { background: #d32f2f; }

/* ===== レスポンシブ ===== */
@media (max-width: 480px) {
  .section { padding: 16px; }
  #stamp-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ===== LINE申請セクション ===== */
.apply-intro {
  font-size: .88rem; color: #555;
  margin-bottom: 16px;
  background: #f0f9f4; border-left: 3px solid #06C755;
  padding: 10px 14px; border-radius: 0 6px 6px 0;
}

.apply-form { display: flex; flex-direction: column; gap: 12px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label {
  font-size: .8rem; color: #555; font-weight: 600;
  display: flex; justify-content: space-between;
}
.char-count { font-weight: 400; color: #aaa; }
.form-group input[type="text"],
.form-group textarea {
  border: 1.5px solid #ccc; border-radius: 8px;
  padding: 8px 10px; font-size: .88rem; font-family: inherit;
  resize: vertical;
}
.form-group input[type="text"]:focus,
.form-group textarea:focus {
  outline: none; border-color: #06C755;
}

/* ブックマークレットステップ説明 */
.bookmarklet-section { margin-top: 20px; border-top: 1.5px solid #eee; padding-top: 20px; }
.bookmarklet-steps { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.bl-step {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: .88rem; color: #444;
}
.bl-num {
  background: #06C755; color: #fff;
  border-radius: 50%; width: 24px; height: 24px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700;
}

/* ブックマークレットボタン（ドラッグ対象） */
.bl-drag-hint {
  font-size: .85rem; color: #06C755; font-weight: 700;
  margin-bottom: 8px; text-align: center;
}
.bookmarklet-btn {
  display: block; width: 100%; max-width: 360px; margin: 0 auto;
  background: linear-gradient(135deg, #06C755, #05a848);
  color: #fff; font-size: 1rem; font-weight: 700;
  padding: 14px 20px; border-radius: 10px; text-align: center;
  text-decoration: none; box-shadow: 0 3px 10px rgba(6,199,85,.35);
  cursor: grab; user-select: none;
  transition: transform .1s, box-shadow .1s;
}
.bookmarklet-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(6,199,85,.4);
}
.bookmarklet-btn:active { transform: scale(.97); cursor: grabbing; }

.bl-note {
  text-align: center; font-size: .75rem; color: #999;
  margin-top: 10px;
}
