/* ══════════════════════════════════════════════════════════
   カラーコード変換 — スタイル
   テーマカラー: Pink (#db2777)
   ══════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #fdf2f8;
  color: #1c1917;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── ヘッダー ── */
header {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 16px;
  height: 52px;
  display: flex;
  align-items: center;
}
.logo { font-weight: 700; font-size: 1.1rem; color: #db2777; text-decoration: none; }
.logo:hover { color: #be185d; }

/* ── メイン ── */
main {
  flex: 1;
  max-width: 700px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  width: 100%;
}

/* ── ヒーロー ── */
.hero { text-align: center; padding: 28px 0 20px; }
.hero-icon { font-size: 3rem; margin-bottom: 10px; }
.hero h1 { font-size: 1.75rem; font-weight: 700; color: #831843; margin-bottom: 6px; }
.description { color: #db2777; font-size: 0.95rem; line-height: 1.7; }

/* ── ツールラップ ── */
.tool-wrap {
  background: #fff;
  border-radius: 20px;
  padding: 28px 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 16px rgba(219,39,119,.1);
}

/* ══════════════════════════════
   カラープレビュー
   ══════════════════════════════ */
.preview-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.color-swatch {
  width: 100%;
  height: 120px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color .25s;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  position: relative;
  overflow: hidden;
}
.swatch-label {
  font-family: 'SFMono-Regular', 'Courier New', monospace;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-shadow: 0 1px 3px rgba(0,0,0,.35);
  user-select: none;
  pointer-events: none;
}

.picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.picker-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #831843;
  cursor: pointer;
}
.color-picker-input {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  padding: 2px;
  background: none;
  box-shadow: 0 0 0 2px #fbcfe8;
  transition: box-shadow .18s;
}
.color-picker-input:hover { box-shadow: 0 0 0 3px #f9a8d4; }
.color-picker-input::-webkit-color-swatch-wrapper { padding: 0; border-radius: 10px; }
.color-picker-input::-webkit-color-swatch { border: none; border-radius: 10px; }

/* ══════════════════════════════
   フォーマット変換
   ══════════════════════════════ */
.formats-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.format-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1.5px solid #fce7f3;
  border-radius: 14px;
  background: #fdf2f8;
  transition: border-color .18s;
}
.format-row:focus-within { border-color: #db2777; background: #fff; }

.format-label-wrap { display: flex; align-items: center; }
.format-label {
  font-size: 0.7rem;
  font-weight: 800;
  color: #db2777;
  text-transform: uppercase;
  letter-spacing: .1em;
  background: #fce7f3;
  padding: 3px 7px;
  border-radius: 6px;
}

/* HEX 入力 */
.hex-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}
.hex-hash {
  font-size: 1.2rem;
  font-weight: 700;
  color: #9ca3af;
  font-family: monospace;
}
.hex-input {
  width: 100%;
  max-width: 120px;
  padding: 6px 8px;
  border: 1.5px solid #fce7f3;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: 'SFMono-Regular', 'Courier New', monospace;
  color: #1c1917;
  background: #fff;
  outline: none;
  text-transform: uppercase;
  letter-spacing: .05em;
  transition: border-color .15s;
}
.hex-input:focus { border-color: #db2777; }

/* RGB / HSL 入力 */
.format-inputs { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.channel-group { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.channel-label { font-size: 0.7rem; font-weight: 700; color: #db2777; }
.channel-with-unit { display: flex; align-items: center; gap: 2px; }

.channel-input {
  width: 58px;
  padding: 6px 6px;
  border: 1.5px solid #fce7f3;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  color: #1c1917;
  background: #fff;
  outline: none;
  -moz-appearance: textfield;
  transition: border-color .15s;
}
.channel-input::-webkit-outer-spin-button,
.channel-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.channel-input:focus { border-color: #db2777; }

.channel-unit { font-size: 0.8rem; color: #9ca3af; font-weight: 600; }

/* コピー部分 */
.format-copy-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.format-preview {
  font-family: 'SFMono-Regular', 'Courier New', monospace;
  font-size: 0.8rem;
  color: #4b5563;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.copy-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: 1.5px solid #fce7f3;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  touch-action: manipulation;
}
.copy-btn:hover { background: #db2777; border-color: #db2777; filter: brightness(1.1); }
.copy-btn.copied { background: #059669; border-color: #059669; }

/* ══════════════════════════════
   色情報バー
   ══════════════════════════════ */
.color-info-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 14px 16px;
  background: #fdf2f8;
  border-radius: 12px;
  border: 1px solid #fce7f3;
}
.info-title {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: #db2777;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 6px;
}
.contrast-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.contrast-badge {
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1.5px solid transparent;
}
.white-badge { background: #f9fafb; border-color: #e5e7eb; color: #374151; }
.black-badge { background: #1f2937; border-color: #374151; color: #f9fafb; }
.badge-pass-aaa { border-color: #059669 !important; }
.badge-pass-aa  { border-color: #d97706 !important; }
.badge-fail     { border-color: #dc2626 !important; opacity: .65; }

.css-name-wrap { display: flex; flex-direction: column; }
.css-name-badge {
  display: inline-block;
  padding: 5px 12px;
  background: #fce7f3;
  color: #831843;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: monospace;
}

/* ══════════════════════════════
   汎用カード
   ══════════════════════════════ */
.card {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 12px rgba(219,39,119,.06);
}
.card h2 { font-size: 1.05rem; font-weight: 700; color: #831843; margin-bottom: 6px; }
.card-sub { font-size: 0.8rem; color: #9ca3af; margin-bottom: 16px; }

/* ══════════════════════════════
   Tint / Shade
   ══════════════════════════════ */
.tint-shade-row {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
  margin-top: 4px;
}
.ts-cell {
  aspect-ratio: 1;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}
.ts-cell:hover { transform: scale(1.1); box-shadow: 0 4px 12px rgba(0,0,0,.2); z-index: 1; }
.ts-cell.is-original { box-shadow: 0 0 0 3px #db2777, 0 2px 8px rgba(0,0,0,.15); }
.ts-hex {
  position: absolute;
  bottom: 3px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.5rem;
  font-weight: 700;
  font-family: monospace;
  opacity: 0;
  transition: opacity .15s;
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
}
.ts-cell:hover .ts-hex { opacity: 1; }

/* ══════════════════════════════
   配色パレット
   ══════════════════════════════ */
.palette-section { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.palette-group { display: flex; align-items: center; gap: 12px; }
.palette-label { font-size: 0.75rem; font-weight: 700; color: #9ca3af; min-width: 64px; }
.palette-row { display: flex; gap: 8px; }
.palette-swatch {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
  transition: transform .15s, box-shadow .15s;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 3px;
}
.palette-swatch:hover { transform: scale(1.1); box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.palette-hex {
  font-size: 0.48rem;
  font-weight: 700;
  font-family: monospace;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
  opacity: 0;
  transition: opacity .15s;
}
.palette-swatch:hover .palette-hex { opacity: 1; }

/* ══════════════════════════════
   ウェブカラー一覧
   ══════════════════════════════ */
.named-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.named-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: transform .15s;
}
.named-cell:hover { transform: scale(1.06); }
.named-swatch {
  width: 100%;
  aspect-ratio: 1.6 / 1;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}
.named-name {
  font-size: 0.65rem;
  font-weight: 600;
  color: #6b7280;
  text-align: center;
  word-break: break-all;
}

/* ── How-to ── */
.how-item { margin-bottom: 14px; }
.how-item:last-child { margin-bottom: 0; }
.how-item h3 { font-size: 0.95rem; font-weight: 600; color: #db2777; margin-bottom: 4px; }
.how-item p  { font-size: 0.875rem; color: #374151; line-height: 1.65; }

/* ── フッター ── */
footer {
  text-align: center;
  padding: 24px 16px;
  font-size: 0.8rem;
  color: #9ca3af;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}
footer a { color: #db2777; text-decoration: none; }
footer a:hover { text-decoration: underline; }
footer p + p { margin-top: 4px; }

.hidden { display: none !important; }

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

/* ─── 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: 540px) {
  .hero h1 { font-size: 1.35rem; }
  .tool-wrap { padding: 20px 14px; }

  .format-row { grid-template-columns: 46px 1fr; gap: 8px; }
  .format-copy-wrap { grid-column: 1 / -1; justify-content: flex-end; }
  .format-preview { max-width: 180px; }

  .channel-input { width: 50px; font-size: 0.88rem; }

  .tint-shade-row { gap: 4px; }

  .palette-group { flex-wrap: wrap; }
  .palette-label { min-width: auto; }

  .named-grid { grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); }

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

/* ━━━ 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; }

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

/* ━━━ 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: #db2777; margin-bottom: .35rem; }
.faq-a { font-size: .85rem; color: #555; line-height: 1.75; }
.faq-a code {
  background: #fdf2f8;
  color: #be185d;
  padding: 1px 5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.85em;
}

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

/* ━━━ カラーコード形式早見表 ━━━ */
.table-note-top {
  font-size: 0.83rem;
  color: #666;
  margin-bottom: 10px;
}
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 10px;
}
.color-ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}
.color-ref-table th {
  background: #fce7f3;
  color: #be185d;
  font-weight: 700;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 2px solid #fbcfe8;
  white-space: nowrap;
}
.color-ref-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #fdf2f8;
  color: #374151;
  vertical-align: top;
  line-height: 1.55;
}
.color-ref-table tr:last-child td { border-bottom: none; }
.color-ref-table .hl-row td { background: #fdf2f8; }
.color-ref-table code {
  background: #fce7f3;
  color: #be185d;
  padding: 1px 5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.85em;
}
.table-note {
  font-size: 0.78rem;
  color: #888;
  line-height: 1.6;
}

/* ━━━ 活用シーン ━━━ */
.scene-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.scene-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #fdf2f8;
  border-radius: 12px;
  padding: 14px;
}
.scene-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
  line-height: 1;
}
.scene-body strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: #be185d;
  margin-bottom: 4px;
}
.scene-body p {
  font-size: 0.8rem;
  color: #555;
  line-height: 1.6;
  margin: 0;
}

/* ━━━ 関連ツール ━━━ */
.related-tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.related-tool-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  background: #fdf2f8;
  border: 1.5px solid #fce7f3;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.related-tool-item:hover {
  border-color: #db2777;
  box-shadow: 0 2px 8px rgba(219,39,119,.15);
}
.related-tool-icon { font-size: 1.6rem; flex-shrink: 0; line-height: 1; }
.related-tool-item strong { display: block; font-size: 0.85rem; font-weight: 700; color: #be185d; margin-bottom: 4px; }
.related-tool-item p { font-size: 0.78rem; color: #666; line-height: 1.55; margin: 0; }

@media (max-width: 540px) {
  .scene-grid { grid-template-columns: 1fr; }
  .related-tools { grid-template-columns: 1fr; }
}
