/* ===== NEXX JP v2 — White standard + Dark toggle ===== */
:root {
    --bg:        #f6f7f9;
    --surface:   #ffffff;
    --surface-2: #f0f2f5;
    --text:      #14181f;
    --text-soft: #5b6573;
    --border:    #e4e8ee;
    --brand:     #ff6a00;   /* アクセント */
    --brand-ink: #ffffff;
    --stock:     #e8453c;   /* 在庫感知 */
    --deal:      #1f9d57;   /* お得情報 */
    --shadow:    0 1px 2px rgba(20,24,31,.06), 0 8px 24px rgba(20,24,31,.06);
    --radius:    14px;
    --maxw:      1160px;
}
[data-theme="dark"] {
    --bg:        #0c0f14;
    --surface:   #151a22;
    --surface-2: #1d242e;
    --text:      #eef1f5;
    --text-soft: #97a1b0;
    --border:    #262e39;
    --brand:     #ff8330;
    --shadow:    0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: "Hiragino Sans", "Noto Sans JP", system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    transition: background .25s ease, color .25s ease;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ===== Header ===== */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 20px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; }
.brand-mark {
    width: 32px; height: 32px; border-radius: 9px;
    display: grid; place-items: center;
    background: var(--brand); color: var(--brand-ink); font-weight: 900;
}
.nav-search { margin-left: auto; }
.nav-search input {
    width: clamp(140px, 26vw, 320px); padding: 9px 16px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: .92rem;
}
.nav-search input:focus { outline: 2px solid color-mix(in srgb, var(--brand) 60%, transparent); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-link {
    width: 40px; height: 40px; border-radius: 999px; display: grid; place-items: center;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
    font-size: 1.05rem; transition: border-color .15s, color .15s;
}
.icon-link:hover { border-color: var(--brand); color: var(--brand); }
.footer-links { margin-bottom: 8px; }
.footer-links a { color: var(--text-soft); font-weight: 600; }
.footer-links a:hover { color: var(--brand); }
.theme-toggle {
    width: 40px; height: 40px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
    display: grid; place-items: center; font-size: 1.1rem; transition: transform .15s;
}
.theme-toggle:hover { transform: rotate(-12deg); }
.theme-toggle__icon--moon { display: none; }
[data-theme="dark"] .theme-toggle__icon--sun { display: none; }
[data-theme="dark"] .theme-toggle__icon--moon { display: inline; }

.main { padding: 32px 20px 64px; }

/* ===== Hero ===== */
.hero { text-align: center; padding: 40px 0 28px; }
.hero__title { font-size: clamp(1.7rem, 4vw, 2.6rem); font-weight: 900; letter-spacing: -.02em; margin: 0 0 10px; }
.hero__lead { color: var(--text-soft); margin: 0 0 22px; }
.accent { color: var(--brand); }
.search { display: flex; gap: 8px; max-width: 520px; margin: 0 auto; }
.search input {
    flex: 1; padding: 12px 16px; border-radius: 999px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text); font-size: 1rem;
}
.search button {
    padding: 12px 22px; border-radius: 999px; border: 0; cursor: pointer;
    background: var(--brand); color: var(--brand-ink); font-weight: 700;
}

/* ===== Category strip ===== */
.cat-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 28px; }
.cat-strip__item {
    padding: 7px 14px; border-radius: 999px; background: var(--surface);
    border: 1px solid var(--border); font-size: .88rem; font-weight: 600; color: var(--text-soft);
    transition: border-color .15s, color .15s;
}
.cat-strip__item:hover { border-color: var(--brand); color: var(--text); }
.cat-strip__item small { color: var(--brand); font-weight: 800; }

/* ===== Section ===== */
.section { margin: 36px 0; }
.section__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section__title { display: flex; align-items: center; gap: 10px; font-size: 1.3rem; font-weight: 800; margin: 0; }
.section__more { color: var(--text-soft); font-weight: 600; }
.section__more:hover { color: var(--brand); }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot--stock { background: var(--stock); }
.dot--deal { background: var(--deal); }

/* ===== Grid + Card ===== */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); }
.card__media { position: relative; aspect-ratio: 1 / 1; background: var(--surface-2); }
.card__media img { width: 100%; height: 100%; object-fit: contain; padding: 12px; }
.card__noimg { width: 100%; height: 100%; display: grid; place-items: center; color: var(--text-soft); }
.badge {
    position: absolute; top: 10px; left: 10px;
    padding: 4px 10px; border-radius: 999px; font-size: .72rem; font-weight: 800; color: #fff;
}
.badge--stock { background: var(--stock); }
.badge--deal { background: var(--deal); }
.badge--restock { background: var(--brand); }
.dot--hot { background: var(--brand); }
.grid--compact { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.card__body { padding: 13px 14px 16px; }
.card__title { font-size: .95rem; font-weight: 700; margin: 0 0 8px; line-height: 1.45;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card__price { font-size: 1.05rem; font-weight: 800; color: var(--brand); margin: 0 0 8px; }
.card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip { font-size: .72rem; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); color: var(--text-soft); }
.chip--coupon { background: color-mix(in srgb, var(--deal) 18%, transparent); color: var(--deal); font-weight: 700; }
.card__time { margin-left: auto; font-size: .72rem; color: var(--text-soft); }

/* ===== Page head / pager ===== */
.page-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 22px; }
.page-head__title { font-size: 1.6rem; font-weight: 900; margin: 0; }
.page-head__count { color: var(--text-soft); }
.search-note { color: var(--text-soft); margin: -10px 0 18px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 36px 0; }
.pager__btn { padding: 10px 20px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-weight: 700; }
.pager__btn:hover { border-color: var(--brand); color: var(--brand); }
.pager__status { color: var(--text-soft); }
.empty { color: var(--text-soft); text-align: center; padding: 40px 0; }

/* ===== Sort bar ===== */
.sortbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; }
.sortbar__item { padding: 7px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: .85rem; font-weight: 600; color: var(--text-soft); }
.sortbar__item:hover { border-color: var(--brand); color: var(--text); }
.sortbar__item.is-active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* ===== Detail ===== */
.crumbs { color: var(--text-soft); font-size: .88rem; margin-bottom: 18px; }
.crumbs a:hover { color: var(--brand); }
.detail { display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 36px; align-items: start; }
.detail__media { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.detail__media img { width: 100%; object-fit: contain; }
.detail__title { font-size: 1.5rem; font-weight: 800; margin: 0 0 6px; line-height: 1.4; }
.detail__asin { font-size: .82rem; color: var(--text-soft); margin: 0 0 14px; }
.detail__asin code { background: var(--surface-2); padding: 2px 7px; border-radius: 6px; }
.detail__price { font-size: 1.8rem; font-weight: 900; color: var(--brand); margin: 0 0 18px; }
.spec-list { margin: 0 0 24px; }
.spec-list__row { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.spec-list__row dt { width: 90px; flex-shrink: 0; color: var(--text-soft); font-weight: 600; }
.spec-list__row dd { margin: 0; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; }
.btn { display: inline-block; padding: 13px 26px; border-radius: 999px; font-weight: 800; cursor: pointer; transition: transform .12s, opacity .15s; }
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: var(--brand); color: var(--brand-ink); }
.btn--ghost { background: var(--surface); border: 1px solid var(--border); }
.pr-note { font-size: .76rem; color: var(--text-soft); margin-top: 14px; }

/* ===== Restock history timeline ===== */
.history { margin: 40px 0; }
.history h2 small { color: var(--text-soft); font-weight: 500; }
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.timeline__item { position: relative; padding: 8px 0 8px 24px; }
.timeline__dot { position: absolute; left: -7px; top: 14px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); border: 2px solid var(--surface); }
.timeline__date { font-weight: 700; margin-right: 10px; }
.timeline__meta { color: var(--text-soft); font-size: .9rem; }

/* ===== チャート＋履歴 70:30 横並び ===== */
.chart-row { display: flex; gap: 18px; align-items: stretch; margin: 40px 0; }
.chart-row > .chart, .chart-row > .history { margin: 0; min-width: 0; }
.chart-row__main { flex: 7; }
.chart-row__side { flex: 3; display: flex; flex-direction: column; }
.chart-row__side .timeline { overflow-y: auto; }
.chart-row__side h2 { font-size: 1.05rem; }
.chart-row__side .timeline__item { padding: 6px 0 6px 20px; }
.chart-row__side .timeline__date { display: block; margin: 0; font-size: .88rem; }
.chart-row__side .timeline__meta { font-size: .8rem; }
@media (max-width: 760px) { .chart-row { flex-direction: column; } }

/* ===== Keepa風チャート ===== */
.chart { margin: 40px 0; }
.chart__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.chart__head h2 { margin: 0; font-size: 1.15rem; }
.chart__head h2 small { color: var(--text-soft); font-weight: 500; font-size: .82rem; }
.chart__legend { display: flex; gap: 16px; font-size: .82rem; color: var(--text-soft); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg::before { content: ""; width: 14px; height: 0; }
.lg--price::before { border-top: 3px solid var(--brand); border-radius: 2px; }
.lg--tick::before { height: 12px; width: 8px; background: var(--brand); opacity: .35; border-radius: 2px; }
.chart__box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.kc { width: 100%; height: auto; display: block; overflow: visible; }
.kc-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; opacity: .7; }
.kc-vguide { stroke: var(--border); stroke-width: 1; opacity: .5; }
.kc-line { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.kc-area { stroke: none; fill: url(#kcgrad); }
.kc-from { stop-color: var(--brand); stop-opacity: .30; }
.kc-to   { stop-color: var(--brand); stop-opacity: 0; }
.kc-bar { fill: var(--brand); opacity: .55; }
.kc-barbase { stroke: var(--border); stroke-width: 1; }
.kc-note { fill: var(--text-soft); font-size: 11px; text-anchor: end; }
.kc-dot { fill: var(--brand); }
.kc-halo { fill: var(--brand); opacity: .20; }
.kc-curlabel { fill: var(--text); font-size: 12px; font-weight: 800; text-anchor: end; }
.kc-ylabel { fill: var(--text-soft); font-size: 11px; text-anchor: end; }
.kc-xlabel { fill: var(--text-soft); font-size: 11px; text-anchor: middle; }

/* ===== 管理ダッシュボード ===== */
.admin { max-width: 680px; margin: 0 auto; }
.admin__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.admin h1 { font-size: 1.5rem; margin: 0 0 4px; }
.admin-note { color: var(--text-soft); font-size: .9rem; margin: 6px 0 20px; }
.admin-form, .admin-add { display: flex; gap: 8px; margin-bottom: 22px; }
.admin-form input, .admin-add input { flex: 1; padding: 11px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 1rem; }
.admin--login { text-align: center; padding-top: 30px; }
.admin--login .admin-form { max-width: 360px; margin: 0 auto 16px; }
.admin-form--login { flex-direction: column; }
.kw-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.kw-item { display: inline-flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-weight: 700; }
.kw-item form { display: inline; }
.kw-del { width: 24px; height: 24px; border-radius: 50%; border: 0; cursor: pointer; background: var(--surface-2); color: var(--text-soft); font-size: 1rem; line-height: 1; }
.kw-del:hover { background: var(--stock); color: #fff; }

.specs-table { margin: 40px 0; }
.specs-table h2 { font-size: 1.15rem; }
.specs-table table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.specs-table th, .specs-table td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--border); font-size: .9rem; vertical-align: top; }
.specs-table th { width: 38%; background: var(--surface-2); color: var(--text-soft); font-weight: 600; }
.specs-table tr:last-child th, .specs-table tr:last-child td { border-bottom: 0; }

/* ===== Footer / error ===== */
.site-footer { border-top: 1px solid var(--border); padding: 28px 0; color: var(--text-soft); font-size: .88rem; text-align: center; }
.footer-note { font-size: .78rem; }
.error-page { text-align: center; padding: 80px 0; }
.error-page h1 { font-size: 4rem; margin: 0; color: var(--brand); }

@media (max-width: 720px) {
    .detail { grid-template-columns: 1fr; }
    .main-nav { gap: 2px; }
    .nav-link { padding: 8px 10px; }
}
