* { margin: 0; padding: 0; box-sizing: border-box; }
button { touch-action: manipulation; }

body {
  font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.7;
  overflow-x: hidden;
}

header {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 1rem 0;
}

.header-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.logo {
  font-size: 1.2rem;
  font-weight: bold;
  color: #dc2626;
  text-decoration: none;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

/* ━━━ ヒーロー ━━━ */
.hero {
  text-align: center;
  padding: 2rem 0 1.25rem;
}

.hero-icon { font-size: 2.5rem; margin-bottom: 0.4rem; }

h1 {
  font-size: 1.75rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.05rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.description {
  color: #666;
  font-size: 0.9rem;
  line-height: 1.8;
}

/* ━━━ カード共通 ━━━ */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  border: 1px solid #e0e0e0;
}

/* ━━━ ツールラッパー ━━━ */
.tool-wrap {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e0e0e0;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

/* ━━━ モードタブ（4つ・2×2グリッド対応） ━━━ */
.mode-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.mode-tab {
  padding: 0.6rem 0.25rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fafafa;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: bold;
  color: #666;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  line-height: 1.3;
}

.mode-tab.active {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.mode-tab:hover:not(.active) {
  border-color: #dc2626;
  color: #dc2626;
}

/* ━━━ ドロップゾーン ━━━ */
.drop-zone {
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  padding: 1.75rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #fafafa;
  margin-bottom: 1rem;
  user-select: none;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: #dc2626;
  background: #fff5f5;
}

.drop-icon { font-size: 1.8rem; margin-bottom: 0.3rem; }

.drop-text {
  font-size: 0.95rem;
  font-weight: bold;
  color: #444;
  margin-bottom: 0.15rem;
}

.drop-sub { font-size: 0.8rem; color: #999; }

/* ━━━ 選択ファイル情報バー ━━━ */
.edit-file-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  background: #fff5f5;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.edit-file-info.hidden { display: none; }

.edit-file-icon { font-size: 1.1rem; }

.edit-file-name {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 500;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edit-file-pages {
  font-size: 0.8rem;
  color: #666;
  flex-shrink: 0;
}

.remove-file-btn {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: #fca5a5;
  color: #7f1d1d;
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
  padding: 0;
}

.remove-file-btn:hover { background: #f87171; }

/* ━━━ 編集オプション共通 ━━━ */
.edit-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.edit-options.hidden { display: none; }

/* ━━━ フォームグループ ━━━ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.82rem;
  font-weight: bold;
  color: #555;
}

.form-label .required {
  display: inline-block;
  font-size: 0.72rem;
  background: #dc2626;
  color: #fff;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  margin-left: 0.35rem;
  font-weight: bold;
  vertical-align: middle;
}

.form-label .optional {
  font-size: 0.75rem;
  font-weight: normal;
  color: #aaa;
  margin-left: 0.35rem;
}

/* ━━━ テキスト入力 ━━━ */
.text-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  color: #333;
  transition: border-color 0.15s;
  background: #fff;
}

.text-input:focus {
  outline: none;
  border-color: #dc2626;
}

/* ━━━ パスワード入力ラップ ━━━ */
.pw-input-wrap {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.15s;
  background: #fff;
}

.pw-input-wrap:focus-within { border-color: #dc2626; }

.pw-input-wrap .text-input {
  border: none;
  border-radius: 0;
  flex: 1;
}

.pw-input-wrap .text-input:focus { outline: none; }

.eye-btn {
  width: 40px;
  border: none;
  background: #f9fafb;
  border-left: 1px solid #e5e7eb;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s;
  padding: 0;
}

.eye-btn:hover { background: #f0f0f0; }

/* ━━━ チェックボックス ━━━ */
.check-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: #444;
  cursor: pointer;
  padding: 0.45rem 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fafafa;
  transition: border-color 0.15s;
}

.check-label:hover { border-color: #dc2626; }

.check-label input[type="checkbox"] {
  accent-color: #dc2626;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ━━━ ラジオボタン ━━━ */
.radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #444;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fafafa;
  transition: all 0.15s;
}

.radio-label.sm { padding: 0.35rem 0.65rem; font-size: 0.85rem; }

.radio-label:hover { border-color: #dc2626; }

.radio-label input[type="radio"] {
  accent-color: #dc2626;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ━━━ 度数ボタン ━━━ */
.deg-btns {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.deg-btn {
  padding: 0.45rem 0.9rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fafafa;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: bold;
  color: #555;
  cursor: pointer;
  transition: all 0.15s;
}

.deg-btn.active {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.deg-btn:hover:not(.active) {
  border-color: #dc2626;
  color: #dc2626;
}

/* ━━━ 範囲入力 ━━━ */
.range-wrap {
  padding: 0.75rem;
  background: #fff5f5;
  border: 1px solid #fca5a5;
  border-radius: 8px;
}

.range-wrap.hidden { display: none; }

.range-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
  color: #333;
  margin-bottom: 0.4rem;
  transition: border-color 0.15s;
}

.range-input:focus {
  outline: none;
  border-color: #dc2626;
}

.range-hint {
  font-size: 0.78rem;
  color: #888;
  line-height: 1.6;
}

/* ━━━ プリセットタグ ━━━ */
.preset-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.preset-tag {
  padding: 0.25rem 0.65rem;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  background: #fafafa;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: bold;
  color: #555;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.03em;
}

.preset-tag:hover {
  border-color: #dc2626;
  color: #dc2626;
  background: #fff5f5;
}

/* ━━━ スライダー ━━━ */
.form-row-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.slider {
  flex: 1;
  accent-color: #dc2626;
  height: 4px;
  cursor: pointer;
}

.slider-val {
  font-size: 0.8rem;
  font-weight: bold;
  color: #dc2626;
  min-width: 2.5rem;
  text-align: right;
  flex-shrink: 0;
}

/* ━━━ カラースウォッチ ━━━ */
.color-swatches {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  outline: none;
  flex-shrink: 0;
  padding: 0;
}

.color-swatch.active,
.color-swatch:hover {
  border-color: #fff;
  box-shadow: 0 0 0 2px #dc2626;
}

.color-custom {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #d1d5db;
  cursor: pointer;
  padding: 0;
  background: none;
  flex-shrink: 0;
  overflow: hidden;
}

/* ━━━ プライマリボタン ━━━ */
.primary-btn {
  display: block;
  width: 100%;
  padding: 0.9rem;
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.15s;
  letter-spacing: 0.03em;
  margin-bottom: 0.6rem;
}

.primary-btn:hover:not(:disabled) { opacity: 0.9; }

.primary-btn:disabled {
  background: #d1d5db;
  cursor: not-allowed;
}

/* ━━━ ステータスメッセージ ━━━ */
.status-msg {
  min-height: 1.4rem;
  font-size: 0.88rem;
  font-weight: bold;
  text-align: center;
  color: #666;
}

.status-msg.success { color: #16a34a; }
.status-msg.error   { color: #dc2626; }

.hidden { display: none; }

/* ━━━ プライバシーカード ━━━ */
.privacy-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.privacy-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.privacy-card strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
  color: #333;
}

.privacy-card p {
  font-size: 0.82rem;
  color: #666;
  line-height: 1.6;
}

/* ━━━ Amazonおすすめ ━━━ */
.amazon-card h2 { margin-bottom: 0.25rem; }
.amazon-note { font-size: 0.82rem; color: #999; margin-bottom: 1rem; }
.amazon-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.amazon-item {
  display: block;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 0.9rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
}
.amazon-item:hover {
  border-color: #FF9900;
  box-shadow: 0 2px 8px rgba(255,153,0,0.15);
  transform: translateY(-1px);
}
.amazon-item-icon { font-size: 1.7rem; margin-bottom: 0.35rem; }
.amazon-item-name { font-size: 0.88rem; font-weight: bold; margin-bottom: 0.2rem; }
.amazon-item-desc { font-size: 0.76rem; color: #888; line-height: 1.5; margin-bottom: 0.45rem; }
.amazon-item-link { font-size: 0.78rem; color: #FF9900; font-weight: bold; }

/* ━━━ 使い方 ━━━ */
.how-item { margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid #f0f0f0; }
.how-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.how-item h3 { font-size: 0.9rem; font-weight: bold; margin-bottom: 0.3rem; color: #dc2626; }
.how-item p { font-size: 0.875rem; color: #666; line-height: 1.7; }

footer {
  text-align: center;
  padding: 2rem;
  color: #999;
  font-size: 0.875rem;
}
footer a { color: #999; text-decoration: none; margin: 0 0.5rem; }
footer a:hover { color: #dc2626; }
footer p { margin-bottom: 0.3rem; }

/* ━━━ レスポンシブ ━━━ */

/* ─── Tips grid (rank-tracker 統一パターン) ──────── */
.tips-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.tip-item { display: flex; gap: .65rem; }
.tip-icon { font-size: 1.4rem; flex-shrink: 0; }
.tip-text strong { display: block; font-weight: 700; margin-bottom: .15rem; font-size: .88rem; }
.tip-text p { font-size: .8rem; color: #78716c; line-height: 1.55; }
@media (max-width: 480px) {
  h1 { font-size: 1.4rem; }
  .tool-wrap { padding: 1rem; }
  .mode-tabs { grid-template-columns: repeat(2, 1fr); }
  .mode-tab { font-size: 0.8rem; padding: 0.55rem 0.2rem; }
  .form-row-2 { grid-template-columns: 1fr; }
  .drop-zone { padding: 1.25rem 0.75rem; }

  .tips-grid { grid-template-columns: 1fr; }
}

.amazon-notice {
  font-size: 0.72rem;
  color: #bbb;
  margin-top: 0.2rem;
}

/* ━━━ 機能別操作手順 ━━━ */
.func-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: .75rem;
}
.func-item {
  background: #f8faff;
  border: 1.5px solid #c7d7fd;
  border-radius: 12px;
  padding: 1rem;
}
.func-heading {
  font-size: .88rem;
  font-weight: 700;
  color: #1a56db;
  margin-bottom: .6rem;
  padding-bottom: .35rem;
  border-bottom: 1.5px solid #dbeafe;
}
.step-list {
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.step-list li { font-size: .8rem; color: #374151; line-height: 1.6; }
.step-note    { font-size: .76rem; color: #9ca3af; margin-top: .2rem; }
@media (max-width: 580px) { .func-grid { grid-template-columns: 1fr; } }

/* ━━━ 活用シーン ━━━ */
.scene-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .75rem;
}
.scene-item {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .85rem 1rem;
  background: #f8faff;
  border: 1.5px solid #c7d7fd;
  border-radius: 12px;
}
.scene-icon { font-size: 1.7rem; flex-shrink: 0; }
.scene-body strong { display: block; font-size: .88rem; font-weight: 700; color: #1a56db; margin-bottom: .2rem; }
.scene-body p { font-size: .78rem; color: #4b5563; line-height: 1.55; margin: 0; }

/* ━━━ 関連ツール ━━━ */
.related-tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem;
}
.related-tool-item {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .85rem 1rem;
  border: 1.5px solid #c7d7fd;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.related-tool-item:hover { border-color: #1a56db; box-shadow: 0 2px 8px rgba(26,86,219,.1); }
.related-tool-icon { font-size: 1.6rem; flex-shrink: 0; }
.related-tool-item strong { display: block; font-size: .88rem; font-weight: 700; color: #1a56db; margin-bottom: .2rem; }
.related-tool-item p { font-size: .76rem; color: #6b7280; line-height: 1.5; margin: 0; }

/* ━━━ ヒーローバッジ ━━━ */
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}
.badge {
  display: inline-block;
  padding: 5px 13px;
  background: #dbeafe;
  color: #1a56db;
  border: 1.5px solid #bfdbfe;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ━━━ FAQ ━━━ */
.faq-list { display: flex; flex-direction: column; }
.faq-item { padding: .9rem 0; border-bottom: 1px solid #f0f0f0; }
.faq-item:last-child { border-bottom: none; padding-bottom: 0; }
.faq-q { font-size: .9rem; font-weight: 700; color: #1a56db; margin-bottom: .35rem; }
.faq-a { font-size: .85rem; color: #555; line-height: 1.75; }
