/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Meiryo', sans-serif;
  color: #222;
  background: #fff;
  line-height: 1.6;
}

a { color: #0066c0; }
a:hover { text-decoration: underline; }

/* ===== Layout ===== */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ===== Header ===== */
.site-header {
  background: #131921;
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-logo {
  color: #FF9900;
  text-decoration: none;
  font-size: 1.3rem;
  font-weight: bold;
  white-space: nowrap;
}

.site-logo span {
  color: #fff;
  font-weight: normal;
}

nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

nav a {
  color: #ccc;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: .85rem;
  transition: color .15s;
}

nav a:hover {
  color: #FF9900;
  text-decoration: none;
}

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: 48px 0 32px;
}

.hero h1 {
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 8px;
}

.hero p {
  color: #666;
  margin-bottom: 28px;
  font-size: 1rem;
}

/* ===== Search Form ===== */
.search-box {
  display: flex;
  gap: 8px;
  max-width: 560px;
  margin: 0 auto;
}

.search-box input {
  flex: 1;
  padding: 13px 16px;
  font-size: 1rem;
  border: 2px solid #ddd;
  border-radius: 6px;
  transition: border-color .2s;
  min-width: 0;
}

.search-box input:focus {
  outline: none;
  border-color: #FF9900;
}

.search-box button {
  padding: 13px 24px;
  background: #FF9900;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s;
}

.search-box button:hover {
  background: #e68a00;
}

.input-hint {
  text-align: center;
  margin-top: 8px;
  font-size: .85rem;
  color: #999;
  min-height: 1.4em;
}

.input-hint.asin { color: #067D62; }
.input-hint.jan  { color: #0066c0; }
.input-hint.error { color: #c0392b; }

/* ===== Breadcrumb ===== */
.breadcrumb {
  font-size: .85rem;
  color: #888;
  margin: 20px 0 0;
}

.breadcrumb a {
  color: #0066c0;
  text-decoration: none;
}

.breadcrumb a:hover { text-decoration: underline; }

/* ===== Product H1 ===== */
.product-h1 {
  font-size: 1.2rem;
  font-weight: bold;
  line-height: 1.5;
  margin: 8px 0 4px;
  color: #222;
}

.result-subtitle {
  font-size: .85rem;
  color: #888;
  margin: 0 0 12px;
}

/* ===== Product Description ===== */
.product-description {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 20px 24px;
  margin: 0 0 24px;
}

.product-description h2 {
  font-size: .85rem;
  color: #888;
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f0f0f0;
}

.product-description .caption-text {
  font-size: .9rem;
  line-height: 1.7;
  color: #444;
  margin: 0;
}

/* ===== Result Card ===== */
.result-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 24px;
  margin: 16px 0;
}

.result-card > h2 {
  font-size: 1rem;
  color: #888;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f0f0f0;
}

/* ===== Code Row ===== */
.code-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  flex-wrap: wrap;
}

.code-label {
  font-size: .75rem;
  font-weight: bold;
  color: #999;
  width: 36px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.code-value {
  font-size: 1.5rem;
  font-weight: bold;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  letter-spacing: .05em;
  color: #111;
}

.copy-btn {
  padding: 4px 12px;
  font-size: .8rem;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  transition: background .15s;
  color: #444;
}

.copy-btn:hover { background: #e8e8e8; }

.copy-btn.copied {
  background: #d4edda;
  border-color: #28a745;
  color: #155724;
}

/* ===== Product Info ===== */
.product-info {
  display: flex;
  gap: 16px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #f0f0f0;
  align-items: flex-start;
}

.product-image a {
  display: block;
  flex-shrink: 0;
}

.product-image img {
  width: 100px;
  height: 100px;
  object-fit: contain;
  border: 1px solid #eee;
  border-radius: 4px;
  background: #fafafa;
}

.product-detail { flex: 1; min-width: 0; }

.product-name {
  font-size: .9rem;
  line-height: 1.5;
  margin-bottom: 10px;
  color: #333;
}

.product-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.rakuten-review {
  font-size: .82rem;
  color: #c45500;
  margin: 4px 0 2px;
}

.rakuten-shop {
  font-size: .78rem;
  color: #888;
  margin: 0 0 4px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 4px;
  text-decoration: none;
  font-size: .875rem;
  font-weight: bold;
  transition: opacity .15s;
}

.btn:hover { opacity: .85; text-decoration: none; }

.btn-amazon { background: #FF9900; color: #fff; }
.btn-rakuten { background: #BF0000; color: #fff; }
.btn-dark { background: #333; color: #fff; }

/* ===== ASIN List (JAN→複数ASIN) ===== */
.asin-list { list-style: none; margin-top: 8px; }

.asin-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
  flex-wrap: wrap;
}

.asin-list li:last-child { border-bottom: none; }

.asin-list .code-value { font-size: 1.1rem; }

.asin-list .detail-link {
  margin-left: auto;
  font-size: .85rem;
  white-space: nowrap;
}

/* ===== Not Found ===== */
.not-found {
  text-align: center;
  padding: 56px 0;
  color: #888;
}

.not-found .big-code {
  font-size: 2rem;
  font-weight: bold;
  color: #ddd;
  font-family: monospace;
  margin-bottom: 12px;
}

/* ===== Section Divider ===== */
.section-divider {
  border: none;
  border-top: 1px solid #eee;
  margin: 32px 0;
}

/* ===== How-To Grid ===== */
.how-to { padding: 32px 0 8px; }
.how-to h2 { font-size: .9rem; color: #aaa; text-align: center; margin-bottom: 24px; letter-spacing: .1em; text-transform: uppercase; }
.how-to-grid { display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; text-align: center; }
.how-to-item { flex: 1; min-width: 150px; max-width: 180px; }
.how-to-item .icon { font-size: 2rem; }
.how-to-item p { font-size: .875rem; color: #555; margin-top: 8px; line-height: 1.6; }

/* ===== Bulk Upload ===== */
.upload-form {
  background: #f9f9f9;
  border: 2px dashed #ddd;
  border-radius: 8px;
  padding: 32px;
  text-align: center;
  color: #555;
}

.upload-form p { margin-bottom: 16px; }
.upload-form input[type="file"] { margin: 8px 0 20px; }
.upload-form .btn-group { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.upload-form button {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  font-size: .9rem;
  font-weight: bold;
  cursor: pointer;
}

/* ===== Result Table ===== */
.result-table { width: 100%; border-collapse: collapse; font-size: .9rem; margin-top: 12px; }
.result-table th { background: #f5f5f5; padding: 8px 12px; border: 1px solid #ddd; text-align: left; }
.result-table td { padding: 8px 12px; border: 1px solid #ddd; font-family: monospace; }
.result-table td.label { font-family: inherit; }
.result-table .empty { color: #ccc; }

/* ===== Info Box ===== */
.info-box {
  background: #fff8e1;
  border-left: 4px solid #FF9900;
  padding: 12px 16px;
  margin: 16px 0;
  border-radius: 0 4px 4px 0;
  font-size: .9rem;
  line-height: 1.6;
}

.info-box.error {
  background: #fff5f5;
  border-color: #dc3545;
}

/* ===== API Docs ===== */
.api-block {
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 14px 16px;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: .875rem;
  overflow-x: auto;
  margin: 10px 0;
  white-space: pre;
  line-height: 1.7;
}

/* ===== FAQ ===== */
.faq dt {
  font-weight: bold;
  margin-top: 20px;
  color: #333;
}

.faq dd {
  margin-top: 4px;
  color: #555;
  line-height: 1.8;
  padding-left: 1em;
}

/* ===== Footer ===== */
.site-footer {
  background: #f5f5f5;
  border-top: 1px solid #ddd;
  padding: 24px 0;
  margin-top: 48px;
  text-align: center;
  font-size: .85rem;
  color: #888;
}

.site-footer a { color: #0066c0; }
.site-footer .small { font-size: .8rem; margin-top: 8px; }

/* ===== Page Title ===== */
.page-title {
  font-size: 1.4rem;
  font-weight: bold;
  margin: 24px 0 8px;
}

.page-lead {
  color: #666;
  margin-bottom: 24px;
  font-size: .95rem;
}

/* ===== Search Ticker ===== */
.ticker-section { padding: 8px 0 24px; }

.ticker-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.ticker-tab {
  padding: 5px 14px;
  font-size: .8rem;
  border: 1px solid #ddd;
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
  color: #666;
  transition: all .15s;
}

.ticker-tab.active {
  background: #131921;
  color: #fff;
  border-color: #131921;
}

.ticker-window {
  overflow: hidden;
  width: 100%;
  border: 1px solid #eee;
  border-radius: 8px;
  background: #fafafa;
  height: 180px;
  display: flex;
  align-items: center;
  position: relative;
}

.ticker-window::before,
.ticker-window::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 36px;
  z-index: 2;
  pointer-events: none;
}
.ticker-window::before { left: 0;  background: linear-gradient(to right, #fafafa, transparent); }
.ticker-window::after  { right: 0; background: linear-gradient(to left,  #fafafa, transparent); }

.ticker-track {
  display: flex;
  gap: 12px;
  padding: 0 20px;
  will-change: transform;
}

.ticker-track:hover { animation-play-state: paused !important; }

@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
  width: 144px;
  transition: opacity .15s;
}
.ticker-card:hover { opacity: .7; text-decoration: none; }

.ticker-img {
  width: 104px;
  height: 104px;
  border-radius: 4px;
  border: 1px solid #e8e8e8;
  background: #e8e8e8;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ticker-img img { width: 100%; height: 100%; object-fit: contain; }

.ticker-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
}

.ticker-badge {
  font-size: .58rem;
  font-weight: bold;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: .04em;
}
.ticker-badge-asin { background: #FF9900; color: #fff; }
.ticker-badge-jan  { background: #0066c0; color: #fff; }

.ticker-code {
  font-size: .62rem;
  font-family: monospace;
  color: #555;
  width: 100%;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticker-empty {
  font-size: .85rem;
  color: #aaa;
  padding: 0 20px;
  white-space: nowrap;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .hero h1 { font-size: 1.5rem; }
  .hero p { font-size: .9rem; }
  .code-value { font-size: 1.2rem; }
  .product-info { flex-direction: column; }
  .product-image img { width: 80px; height: 80px; }
  nav a { font-size: .8rem; padding: 4px 8px; }
  .search-box { flex-direction: column; }
  .search-box button { width: 100%; }
}
