/* ─── Reset & Base ──────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.hidden { display: none !important; }

body {
  font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  background: #f0f9ff;
  color: #0c1a2e;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Header ─────────────────────────────────── */
header {
  background: #0284c7;
  color: #fff;
  padding: 0 1rem;
  height: 52px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(2,132,199,.35);
}
.header-inner { max-width: 900px; width: 100%; margin: 0 auto; }
.logo { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; }

/* ─── Main ───────────────────────────────────── */
main { max-width: 860px; width: 100%; margin: 0 auto; padding: 1.5rem 1rem 3rem; flex: 1; }

/* ─── Hero ───────────────────────────────────── */
.hero { text-align: center; margin-bottom: 1.5rem; }
.hero-icon { font-size: 3rem; margin-bottom: .5rem; }
.hero h1 { font-size: 1.75rem; font-weight: 800; color: #0284c7; margin-bottom: .5rem; }
.description { color: #475569; font-size: .95rem; line-height: 1.7; }

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

/* ─── Tab Bar ────────────────────────────────── */
.tab-bar {
  display: flex;
  border-bottom: 2px solid #bae6fd;
  margin-bottom: 1rem;
}
.tab-btn {
  padding: .7rem 1.75rem;
  font-size: .95rem;
  font-weight: 700;
  color: #64748b;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: #0284c7; }
.tab-btn.active { color: #0284c7; border-bottom-color: #0284c7; }

.tab-pane { display: none; }
.tab-pane.active { display: flex; flex-direction: column; gap: 1rem; }

/* ─── Card ───────────────────────────────────── */
.card {
  background: #fff;
  border-radius: 16px;
  border: 1.5px solid #bae6fd;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(2,132,199,.07);
}
.card h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0284c7;
  margin-bottom: .9rem;
}
.card-desc { font-size: .875rem; color: #64748b; margin-bottom: 1rem; line-height: 1.6; }
.card-action { display: flex; justify-content: flex-end; margin-top: 1rem; }

/* ─── Step Badge ─────────────────────────────── */
.step-badge {
  display: inline-block;
  background: #0ea5e9;
  color: #fff;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .1em;
  padding: .2rem .65rem;
  border-radius: 20px;
  margin-bottom: .5rem;
}

/* ─── Drop Zone ──────────────────────────────── */
.drop-zone {
  border: 2px dashed #7dd3fc;
  border-radius: 12px;
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: #f0f9ff;
  position: relative;
  user-select: none;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: #0284c7;
  background: #e0f2fe;
}
.drop-icon { font-size: 2.5rem; margin-bottom: .5rem; pointer-events: none; }
.drop-text { font-size: .95rem; font-weight: 600; color: #0369a1; margin-bottom: .25rem; pointer-events: none; }
.drop-sub { font-size: .8rem; color: #94a3b8; pointer-events: none; }
.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

/* ─── File List ──────────────────────────────── */
.file-list { display: flex; flex-direction: column; gap: .4rem; margin-top: .75rem; }
.file-item {
  display: flex;
  align-items: center;
  gap: .65rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: .5rem .85rem;
}
.fi-icon { font-size: 1.15rem; flex-shrink: 0; }
.fi-name { flex: 1; font-size: .875rem; font-weight: 500; color: #1e293b; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fi-size { font-size: .78rem; color: #94a3b8; white-space: nowrap; }

/* ─── Buttons ────────────────────────────────── */
.btn-main {
  background: #0284c7;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: .65rem 1.75rem;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.btn-main:hover:not(:disabled) { background: #0369a1; }
.btn-main:disabled { opacity: .4; cursor: not-allowed; }

.btn-ghost {
  background: none;
  border: 1.5px solid #bae6fd;
  border-radius: 8px;
  padding: .4rem 1rem;
  font-size: .85rem;
  color: #0284c7;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.btn-ghost:hover { background: #e0f2fe; border-color: #7dd3fc; }

/* ─── Code Display (sender) ──────────────────── */
.code-display-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.code-display {
  font-family: 'Courier New', 'Menlo', monospace;
  font-size: 2.6rem;
  font-weight: 900;
  letter-spacing: .55rem;
  color: #0c4a6e;
  background: #f0f9ff;
  border: 2px solid #7dd3fc;
  border-radius: 12px;
  padding: .5rem 1.25rem .5rem 1.8rem; /* letter-spacing shifts right */
  min-width: 0;
  text-align: center;
}

/* ─── QR Code ────────────────────────────────── */
.qr-wrap { text-align: center; margin-bottom: 1rem; }
.qr-wrap canvas {
  border-radius: 10px;
  border: 2px solid #e2e8f0;
  max-width: 200px;
}
.qr-caption { font-size: .8rem; color: #94a3b8; margin-top: .4rem; }

/* ─── Status Row ─────────────────────────────── */
.status-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .875rem;
  color: #475569;
  padding: .5rem 0 .2rem;
}
.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #94a3b8;
  transition: background .3s;
}
.status-dot.waiting  { background: #f59e0b; animation: blink 1.4s ease-in-out infinite; }
.status-dot.connected { background: #22c55e; }
.status-dot.done     { background: #22c55e; }
.status-dot.error    { background: #ef4444; }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}

/* ─── Progress ───────────────────────────────── */
.progress-file { margin-bottom: .6rem; }
.progress-file:last-child { margin-bottom: 0; }
.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: .82rem;
  margin-bottom: .35rem;
}
.progress-name { font-weight: 600; color: #1e293b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.progress-bytes { color: #94a3b8; white-space: nowrap; flex-shrink: 0; }
.progress-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #0284c7);
  border-radius: 4px;
  transition: width .25s ease;
  min-width: 4px;
}

.done-msg {
  text-align: center;
  font-size: .9rem;
  font-weight: 600;
  color: #16a34a;
  margin-top: .9rem;
  padding: .6rem .5rem;
  background: #f0fdf4;
  border-radius: 8px;
  border: 1px solid #bbf7d0;
}

/* ─── Connect Row ────────────────────────────── */
.connect-row {
  display: flex;
  gap: .75rem;
  align-items: center;
  flex-wrap: wrap;
}
.code-input {
  font-family: 'Courier New', 'Menlo', monospace;
  font-size: 1.7rem;
  font-weight: 900;
  letter-spacing: .35rem;
  text-transform: uppercase;
  color: #0c4a6e;
  background: #f0f9ff;
  border: 2px solid #7dd3fc;
  border-radius: 10px;
  padding: .5rem 1rem .5rem 1.35rem; /* compensate letter-spacing */
  width: 220px;
  text-align: center;
  outline: none;
  transition: border-color .15s;
  caret-color: #0284c7;
}
.code-input:focus { border-color: #0284c7; box-shadow: 0 0 0 3px rgba(2,132,199,.15); }
.code-input::placeholder { color: #cbd5e1; letter-spacing: .25rem; font-weight: 400; }

/* ─── Download ───────────────────────────────── */
#download-list { display: flex; flex-direction: column; gap: .55rem; }
.dl-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: .75rem 1rem;
  flex-wrap: wrap;
}
.dl-info { display: flex; align-items: center; gap: .6rem; min-width: 0; flex: 1; }
.dl-name { font-size: .9rem; font-weight: 600; color: #1e293b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.dl-size { font-size: .78rem; color: #94a3b8; }
.btn-dl {
  background: #16a34a;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: .5rem 1.2rem;
  font-size: .875rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s;
  flex-shrink: 0;
}
.btn-dl:hover { background: #15803d; }
.dl-note { font-size: .78rem; color: #94a3b8; margin-top: .75rem; }

/* ─── Info cards ─────────────────────────────── */
.info-card { margin-top: 1rem; }

.how-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.how-col h3 { font-size: .9rem; font-weight: 700; color: #334155; margin-bottom: .6rem; }
.how-list { padding-left: 1.2rem; }
.how-list li { font-size: .875rem; color: #475569; line-height: 1.75; }

.note-list { padding-left: 1.2rem; }
.note-list li { font-size: .85rem; color: #64748b; line-height: 1.75; }
.note-list li + li { margin-top: .3rem; }

/* ─── Tips grid ──────────────────────────────── */
.tips-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.tip-item { display: flex; gap: .75rem; }
.tip-icon { font-size: 1.5rem; flex-shrink: 0; }
.tip-text strong { display: block; font-weight: 700; margin-bottom: .2rem; font-size: .9rem; }
.tip-text p { font-size: .82rem; color: #78716c; line-height: 1.5; }

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

/* ━━━ 活用シーン ━━━ */
.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: #f0f9ff;
  border: 1.5px solid #bae6fd;
  border-radius: 12px;
}
.scene-icon { font-size: 1.7rem; flex-shrink: 0; }
.scene-body strong { display: block; font-size: .88rem; font-weight: 700; color: #0c4a6e; 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 #e2e8f0;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.related-tool-item:hover { border-color: #0284c7; box-shadow: 0 2px 8px rgba(2,132,199,.1); }
.related-tool-icon { font-size: 1.6rem; flex-shrink: 0; }
.related-tool-item strong { display: block; font-size: .88rem; font-weight: 700; color: #0284c7; margin-bottom: .2rem; }
.related-tool-item p { font-size: .76rem; color: #888; line-height: 1.5; margin: 0; }

/* ─── 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: #0284c7; margin-bottom: .35rem; }
.faq-a { font-size: .85rem; color: #555; line-height: 1.75; }

/* ─── Footer ─────────────────────────────────── */
footer {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: .82rem;
  color: #94a3b8;
  border-top: 1px solid #e2e8f0;
  margin-top: auto;
}
footer a { color: #0284c7; text-decoration: none; }
footer a:hover { text-decoration: underline; }
footer p + p { margin-top: .3rem; }

/* ─── Responsive ─────────────────────────────── */
@media (max-width: 640px) {
  .hero h1 { font-size: 1.45rem; }
  .tab-btn { padding: .65rem 1rem; font-size: .875rem; }
  .code-display { font-size: 1.9rem; letter-spacing: .4rem; padding-left: 1.3rem; }
  .how-cols { grid-template-columns: 1fr; gap: 1rem; }
  .scene-grid { grid-template-columns: 1fr; }
  .amazon-grid { grid-template-columns: 1fr; }
  .connect-row { flex-direction: column; align-items: stretch; }
  .code-input { width: 100%; }
  .btn-main { width: 100%; text-align: center; }
  .dl-item { flex-direction: column; align-items: flex-start; }
  .btn-dl { width: 100%; text-align: center; }
}
