/* deal.css は index.html から直接読込（@import だと SW/ブラウザキャッシュが古いまま残る） */

/* ── App Shell ── */
body.dealmax-app {
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

.app-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: var(--bg);
  transition: opacity 0.4s ease, visibility 0.4s;
}

.app-splash.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-splash__logo {
  width: 72px; height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--amazon), var(--rakuten));
  display: grid;
  place-items: center;
  color: #fff;
  margin-bottom: 1rem;
  animation: splashPulse 1.2s ease infinite;
}

.app-splash__title {
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
}

.app-splash__sub {
  color: var(--muted);
  font-size: 0.875rem;
  margin-top: 0.35rem;
  text-align: center;
}

@keyframes splashPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(45, 212, 168, 0.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 24px rgba(45, 212, 168, 0.3); }
}

.app-tab { display: none; }
.app-tab.active { display: block; }

.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 300;
  display: flex;
  justify-content: space-around;
  padding: 0.5rem 0 calc(0.5rem + env(safe-area-inset-bottom));
  background: rgba(6, 8, 15, 0.92);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.bottom-nav__btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.625rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  padding: 0.35rem;
  transition: color 0.15s;
}

.bottom-nav__btn.active { color: var(--accent); }
.bottom-nav__btn svg { width: 22px; height: 22px; }

.bottom-nav__badge {
  position: absolute;
  top: 2px;
  margin-left: 18px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--best);
  color: #041510;
  font-size: 0.5625rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.bottom-nav__wrap { position: relative; display: flex; flex-direction: column; align-items: center; }

.install-banner {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom));
  left: 1rem; right: 1rem;
  z-index: 250;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(91, 157, 255, 0.15), rgba(45, 212, 168, 0.12));
  border: 1px solid rgba(91, 157, 255, 0.35);
  box-shadow: var(--shadow);
}

.install-banner[hidden] { display: none !important; }

.install-banner__text { flex: 1; font-size: 0.8125rem; }
.install-banner__text strong { display: block; font-size: 0.875rem; margin-bottom: 0.15rem; }

.install-banner__actions { display: flex; gap: 0.4rem; }

.btn-sm {
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  border: 0;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.btn-sm--primary { background: var(--accent); color: #fff; }
.btn-sm--ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }

/* ── Detail Sheet ── */
.detail-sheet {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 100%;
  width: 100%;
  max-height: 100%;
  margin: auto 0 0;
}

.detail-sheet::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.detail-sheet[open] {
  animation: sheetUp 0.35s ease;
}

@keyframes sheetUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.detail-sheet__panel {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid var(--border);
  border-bottom: 0;
  max-height: 92vh;
  overflow-y: auto;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

.detail-sheet__handle {
  width: 40px; height: 4px;
  border-radius: 999px;
  background: var(--border-light);
  margin: 0.65rem auto;
}

.detail-sheet__head {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 1rem;
  padding: 0 1.25rem 1rem;
  align-items: start;
}

.detail-sheet__img { width: 120px; height: 120px; border-radius: 14px; border: 1px solid var(--border); }
.detail-sheet__meta h2 { margin: 0 0 0.35rem; font-size: 1.15rem; }
.detail-sheet__meta p { margin: 0; color: var(--muted); font-size: 0.8125rem; }

.detail-sheet__actions {
  display: flex;
  gap: 0.4rem;
}

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1rem;
}

.icon-btn.active { border-color: #ff6b6b; color: #ff6b6b; }

.detail-sheet__cta {
  padding: 0 1.25rem 1rem;
}

.cta-best {
  display: block;
  width: 100%;
  padding: 1rem;
  border-radius: 14px;
  border: 0;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  transition: transform 0.15s;
}

.cta-best:hover { transform: scale(1.02); }
.cta-best.amazon { background: var(--amazon); color: #111; }
.cta-best.rakuten { background: var(--rakuten); color: #fff; }

.cta-best small {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0.85;
  margin-top: 0.2rem;
}

/* ── Settings Tab ── */
.settings-panel {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.25rem;
  display: grid;
  gap: 1rem;
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.settings-card h3 {
  margin: 0 0 0.75rem;
  font-size: 0.9375rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}

.stat-box {
  text-align: center;
  padding: 0.85rem 0.5rem;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.stat-box strong {
  display: block;
  font-size: 1.25rem;
  color: var(--best);
}

.stat-box span { font-size: 0.6875rem; color: var(--muted); }

.recent-clicks {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  gap: 0.5rem;
}

.recent-clicks li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8125rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.recent-clicks li:last-child { border-bottom: 0; }

.settings-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.85rem 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.settings-link:last-child { border-bottom: 0; }

.legal-text {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.7;
}

.legal-text h4 { color: var(--text); margin: 1rem 0 0.35rem; font-size: 0.8125rem; }
.legal-text h4:first-child { margin-top: 0; }

/* ── Onboarding ── */
.onboard-modal { max-width: 440px; width: calc(100% - 2rem); }
.onboard-steps { display: grid; gap: 1rem; margin: 1rem 0; }
.onboard-step {
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.onboard-step__num {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--accent-dim);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.8125rem;
  flex-shrink: 0;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: calc(88px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 500;
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-light);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: 0.3s ease;
  box-shadow: var(--shadow);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.fav-btn {
  position: absolute;
  top: 0.85rem; left: 0.85rem;
  z-index: 3;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 0;
  background: rgba(6, 8, 15, 0.75);
  backdrop-filter: blur(4px);
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  display: grid;
  place-items: center;
  transition: 0.15s;
}

.fav-btn.active { color: #ff6b6b; }

.product-card__media { position: relative; }

.product-card__name-btn {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.product-card__name-btn:hover { color: var(--accent); }

.deal-header { z-index: 200; }

.deal-logo { pointer-events: none; }

.app-version {
  text-align: center;
  font-size: 0.6875rem;
  color: var(--muted);
  padding: 0 1rem 1rem;
}

.price-presets,
.price-presets-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 0.625rem;
}

.price-presets-bar {
  margin: 0 0 0.75rem;
  padding: 0.625rem 0.75rem;
  background: var(--surface-2, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 0.75rem;
}

.price-preset-chip {
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  background: var(--surface, rgba(255, 255, 255, 0.03));
  color: var(--text);
  border-radius: 999px;
  padding: 0.3125rem 0.6875rem;
  font-size: 0.75rem;
  line-height: 1.2;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.price-preset-chip:hover {
  border-color: var(--accent, #5b9dff);
  color: var(--accent, #5b9dff);
}

.price-preset-chip.is-active {
  background: rgba(91, 157, 255, 0.14);
  border-color: var(--accent, #5b9dff);
  color: var(--accent, #5b9dff);
  font-weight: 600;
}

@media (max-width: 768px) {
  .price-presets-bar { display: none; }
}

body.dealmax-booting .product-card,
body.dealmax-booting .deal-card {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}

@media (min-width: 769px) {
  body.dealmax-app { padding-bottom: 0; }
  .bottom-nav { display: none; }
  .install-banner { bottom: 1rem; max-width: 420px; left: auto; right: 1rem; }
}

@media (max-width: 768px) {
  .deal-nav { display: none; }
  .detail-sheet__head { grid-template-columns: 88px 1fr; }
  .detail-sheet__actions { grid-column: 2; justify-self: end; }
  .detail-sheet__img { width: 88px; height: 88px; }
}

.deal-nav__tab {
  margin-left: 1.25rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  transition: color 0.15s;
}

.deal-nav__tab.active,
.deal-nav__tab:hover { color: var(--text); }

.tag.asin {
  background: rgba(91, 157, 255, 0.1);
  color: var(--accent);
  font-family: ui-monospace, monospace;
}

.product-card__price-ref {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
  background: rgba(251, 191, 36, 0.18);
  color: #b45309;
}

.price-fresh {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.price-fresh--live {
  background: rgba(34, 197, 94, 0.16);
  color: #15803d;
}

.price-fresh--ref {
  background: rgba(251, 191, 36, 0.18);
  color: #b45309;
}

.price-fresh--stale {
  background: rgba(148, 163, 184, 0.2);
  color: #64748b;
}

.trust-chip--yodo {
  background: rgba(59, 130, 246, 0.14);
  color: #1d4ed8;
}

.trust-chip--yodo-ref {
  background: rgba(148, 163, 184, 0.18);
  color: #475569;
}

.settings-setup-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-setup-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted, #64748b);
}

.settings-setup-item--ok {
  color: #15803d;
}

.settings-setup-item--todo {
  color: #b45309;
}

.settings-setup-item--hint {
  font-size: 12px;
  color: var(--text-muted, #64748b);
  padding-left: 1.25rem;
  list-style: disc;
}

.settings-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border, rgba(148, 163, 184, 0.2));
  cursor: pointer;
}

.settings-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent, #4f8cff);
}

.settings-setup-item__mark {
  font-weight: 700;
  flex-shrink: 0;
}

.product-grid--virtual .virtual-grid__cell {
  min-width: 0;
}

.product-grid--virtual-loading {
  opacity: 0.98;
}

.catalog-load-progress__pause {
  margin-left: 10px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font-size: 12px;
  cursor: pointer;
}

.catalog-load-progress__pause:hover {
  background: rgba(255, 255, 255, 0.08);
}
