/* =========================================================
   RankCotte - Design System
   ガジェット比較ランキング
   ========================================================= */

/* ---------- Design Tokens ---------- */
:root {
  --brand:        #1667e0;
  --brand-dark:   #0f4fb5;
  --brand-light:  #e8f1ff;
  --gold:         #f5a623;
  --silver:       #9aa5b1;
  --bronze:       #cd8232;
  --star:         #ffb400;

  --rakuten:      #bf0000;
  --amazon:       #ff9900;
  --yahoo:        #ff0033;
  --a8:           #1a2233;

  --up:           #e8483d;
  --down:         #1a9e5f;

  --bg:           #f2f5f9;
  --bg-alt:       #eaeff5;
  --card:         #ffffff;
  --text:         #1a2233;
  --text-strong:  #0d1526;
  --muted:        #6b7684;
  --border:       #e3e8ef;
  --shadow:       0 1px 3px rgba(20,30,50,.08), 0 1px 2px rgba(20,30,50,.04);
  --shadow-md:    0 4px 16px rgba(20,30,50,.10);
  --radius:       12px;
  --radius-sm:    8px;
  --maxw:         1200px;
  --nav-h:        56px;
}

:root[data-theme="dark"] {
  --brand:        #4a90ff;
  --brand-dark:   #2f6fe0;
  --brand-light:  #16233d;
  --bg:           #0f1523;
  --bg-alt:       #131b2c;
  --card:         #1a2234;
  --text:         #e6eaf2;
  --text-strong:  #f4f7fc;
  --muted:        #94a0b3;
  --border:       #2a3450;
  --shadow:       0 1px 3px rgba(0,0,0,.4);
  --shadow-md:    0 4px 16px rgba(0,0,0,.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand:        #4a90ff;
    --brand-dark:   #2f6fe0;
    --brand-light:  #16233d;
    --bg:           #0f1523;
    --bg-alt:       #131b2c;
    --card:         #1a2234;
    --text:         #e6eaf2;
    --text-strong:  #f4f7fc;
    --muted:        #94a0b3;
    --border:       #2a3450;
    --shadow:       0 1px 3px rgba(0,0,0,.4);
    --shadow-md:    0 4px 16px rgba(0,0,0,.5);
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic",
    Meiryo, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; margin: 0; padding: 0; }
button { font-family: inherit; cursor: pointer; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

/* ---------- Top utility bar ---------- */
.topbar {
  background: var(--brand-dark);
  color: #fff;
  font-size: 12px;
}
.topbar .container {
  display: flex; align-items: center; justify-content: space-between;
  height: 34px;
}
.topbar__left { opacity: .95; }
.topbar__right { display: flex; gap: 18px; }
.topbar__right a { opacity: .9; }
.topbar__right a:hover { opacity: 1; }

/* ---------- Header ---------- */
.header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.header .container {
  display: flex; align-items: center; gap: 20px;
  height: 68px;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo__crown { color: var(--brand); font-size: 26px; line-height: 1; }
.logo__text { display: flex; flex-direction: column; }
.logo__name { font-size: 22px; font-weight: 800; color: var(--text-strong); letter-spacing: -.02em; }
.logo__sub  { font-size: 11px; color: var(--muted); margin-top: -2px; }

.search {
  flex: 1; max-width: 460px;
  display: flex; align-items: center;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
}
.search input {
  flex: 1; border: 0; background: transparent; color: var(--text);
  padding: 11px 14px; font-size: 14px; outline: none;
}
.search button {
  border: 0; background: var(--brand); color: #fff;
  padding: 0 16px; align-self: stretch; display: grid; place-items: center;
}

.header__actions { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.header__action {
  display: flex; flex-direction: column; align-items: center;
  font-size: 11px; color: var(--muted); gap: 2px;
}
.header__action .ic { font-size: 17px; }

/* dark mode toggle */
.theme-toggle {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
}
.switch { position: relative; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; background: var(--border);
  border-radius: 22px; transition: .2s;
}
.switch .slider::before {
  content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::before { transform: translateX(18px); }

.hamburger { display: none; font-size: 22px; color: var(--text); background: none; border: 0; }

/* ---------- Nav ---------- */
.nav {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 68px; z-index: 40;
}
.nav__list { display: flex; gap: 4px; overflow-x: auto; }
.nav__list a {
  display: flex; align-items: center; gap: 6px;
  padding: 14px 16px; font-size: 14px; font-weight: 600;
  color: var(--text); white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.nav__list a:hover { color: var(--brand); }
.nav__list a.is-active { color: var(--brand); border-bottom-color: var(--brand); }

/* ---------- Layout blocks ---------- */
main { padding: 24px 0 40px; }
.section { margin-bottom: 34px; }
.section__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section__title {
  display: flex; align-items: center; gap: 8px;
  font-size: 19px; font-weight: 800; color: var(--text-strong); margin: 0;
}
.section__title .ic { color: var(--gold); }
.section__more { font-size: 13px; color: var(--brand); font-weight: 600; }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: 340px 1fr; gap: 20px; margin-bottom: 34px; }
.hero__pitch {
  background: linear-gradient(150deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff; border-radius: var(--radius); padding: 28px 26px;
  display: flex; flex-direction: column;
}
.hero__pitch h1 { font-size: 26px; font-weight: 800; margin: 0 0 12px; line-height: 1.35; }
.hero__pitch p { font-size: 14px; opacity: .95; margin: 0 0 20px; }
.hero__stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-top: auto; }
.hero__stat {
  background: rgba(255,255,255,.14); border-radius: var(--radius-sm);
  padding: 8px 6px; text-align: center;
}
.hero__stat .label { font-size: 10px; opacity: .85; display: block; }
.hero__stat .value { font-size: 16px; font-weight: 800; }
.hero__note { font-size: 10px; opacity: .8; margin: 12px 0 0; }

.hero__rank { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); padding: 18px; box-shadow: var(--shadow); }
.hero__rank-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.hero__rank-head h2 { font-size: 16px; font-weight: 800; margin: 0; }
.hero__rank-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 10px; }

/* ---------- Product mini card (ranking grid) ---------- */
.mini {
  position: relative; text-align: center; padding: 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); transition: .15s;
}
.mini:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.mini__rank {
  position: absolute; top: -8px; left: -8px; width: 26px; height: 26px;
  display: grid; place-items: center; border-radius: 50%;
  font-size: 13px; font-weight: 800; color: #fff; background: var(--silver);
  box-shadow: var(--shadow);
}
.mini__rank.r1 { background: var(--gold); }
.mini__rank.r2 { background: var(--silver); }
.mini__rank.r3 { background: var(--bronze); }
.mini__img { aspect-ratio: 1; object-fit: contain; margin: 6px auto; }
.mini__name { font-size: 12px; font-weight: 600; line-height: 1.35; height: 3em; overflow: hidden; }
.mini__rating { font-size: 12px; color: var(--star); font-weight: 700; margin: 4px 0 2px; }
.mini__rating span { color: var(--muted); font-weight: 400; }
.mini__price { font-size: 15px; font-weight: 800; color: var(--text-strong); }
.mini__off { font-size: 11px; color: var(--up); font-weight: 700; }

/* ---------- Keyword / category chips ---------- */
.two-col { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,2fr); gap: 32px; }
.two-col > div + div { border-left: 1px solid var(--border); padding-left: 32px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 14px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 999px; font-size: 13px; color: var(--text); font-weight: 500;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }

.cat-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 8px; }
.cat {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-width: 0; padding: 12px 2px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); text-align: center; font-size: 9px; font-weight: 600;
  line-height: 1.3; letter-spacing: -0.2px; white-space: nowrap;
}
.cat:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.cat__ic { font-size: 24px; color: var(--brand); }

/* ---------- Feature cards ---------- */
.feature-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.feature {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--card); box-shadow: var(--shadow);
}
.feature__tag { font-size: 11px; color: var(--brand); font-weight: 700; }
.feature__title { font-size: 15px; font-weight: 800; color: var(--text-strong); }
.feature__ic { font-size: 34px; margin-left: auto; }

/* ---------- Main + Sidebar grid ---------- */
.with-side { display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; }

/* ---------- Big rank card ---------- */
.rank-list { display: grid; grid-template-columns: repeat(5,1fr); gap: 12px; }
.pcard {
  position: relative; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.pcard:hover { box-shadow: var(--shadow-md); }
.pcard__rank {
  position: absolute; top: -10px; left: -10px; width: 30px; height: 30px;
  display: grid; place-items: center; border-radius: 50%;
  font-size: 15px; font-weight: 800; color: #fff; background: var(--silver); box-shadow: var(--shadow);
}
.pcard__rank.r1 { background: var(--gold); }
.pcard__rank.r2 { background: var(--silver); }
.pcard__rank.r3 { background: var(--bronze); }
.pcard__badge {
  position: absolute; top: 10px; right: 10px; font-size: 10px; font-weight: 700;
  background: var(--brand); color: #fff; padding: 3px 8px; border-radius: 4px;
}
.pcard__img { aspect-ratio: 1; object-fit: contain; margin: 10px auto; }
.pcard__name { font-size: 13px; font-weight: 700; line-height: 1.4; min-height: 3.6em; }
.pcard__rating { font-size: 13px; color: var(--star); font-weight: 700; margin: 6px 0 4px; }
.pcard__rating span { color: var(--muted); font-weight: 400; font-size: 11px; }
.pcard__price { font-size: 18px; font-weight: 800; color: var(--text-strong); }
.pcard__price .tag { font-size: 10px; color: var(--down); background: rgba(26,158,95,.12); padding: 2px 6px; border-radius: 4px; margin-left: 4px; vertical-align: middle; }
.pcard__spec { font-size: 11px; color: var(--muted); margin: 8px 0; line-height: 1.7; }
.pcard__spec li::before { content: "・"; }
.pcard__compare {
  display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted);
  font-weight: 500; margin: 6px 0; cursor: pointer; user-select: none;
}
.pcard__compare input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }

/* ---------- Offer buttons ---------- */
.offers { display: flex; flex-direction: column; gap: 5px; margin-top: auto; }
.btn-offer {
  display: block; text-align: center; padding: 8px; border-radius: var(--radius-sm);
  color: #fff; font-size: 12px; font-weight: 700;
}
.btn-offer.rakuten { background: var(--rakuten); }
.btn-offer.amazon  { background: var(--amazon); }
.btn-offer.yahoo   { background: var(--yahoo); }
.btn-offer:hover { filter: brightness(1.08); }
.btn-line {
  display: block; text-align: center; padding: 7px; margin-top: 5px;
  border: 1px solid var(--brand); color: var(--brand); border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 700;
}
.btn-line:hover { background: var(--brand-light); }
.link-review { display: block; text-align: center; font-size: 11px; color: var(--muted); margin-top: 6px; }

/* ---------- Sidebar widgets ---------- */
.widget { margin-bottom: 22px; }
.widget__title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 15px; font-weight: 800; color: var(--text-strong); margin: 0 0 12px;
}
.review-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.review-item img { width: 56px; height: 56px; object-fit: contain; border-radius: 6px; background: var(--bg); }
.review-item .tag { font-size: 10px; font-weight: 700; color: var(--brand); }
.review-item .ttl { font-size: 12px; font-weight: 600; line-height: 1.4; }
.review-item .date { font-size: 10px; color: var(--muted); }

.maker-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.maker-chips a {
  padding: 8px 14px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; font-weight: 600; color: var(--brand);
}
.maker-chips a:hover { background: var(--brand-light); }

.price-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.price-grid a {
  padding: 10px; text-align: center; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 12px; font-weight: 700; color: var(--text);
}
.price-grid a:hover { border-color: var(--brand); color: var(--brand); }

/* ---------- Spec compare table ---------- */
.table-wrap { overflow-x: auto; }
.spec-table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 640px; }
.spec-table th, .spec-table td {
  border: 1px solid var(--border); padding: 10px 8px; text-align: center;
}
.spec-table thead th { background: var(--bg-alt); font-weight: 700; }
.spec-table th[scope="row"] { background: var(--bg); text-align: left; width: 90px; font-weight: 600; color: var(--muted); }
.spec-table img { height: 46px; object-fit: contain; margin: 0 auto; }
.spec-table .price { font-weight: 800; color: var(--text-strong); }
.spec-table .rating { color: var(--star); font-weight: 700; }
.spec-table .btn-sm {
  display: inline-block; background: var(--brand); color: #fff;
  padding: 5px 12px; border-radius: 6px; font-weight: 700;
}

/* ---------- 4-col link lists (用途別/価格帯/特集/FAQ) ---------- */
.quad { display: grid; grid-template-columns: repeat(4,1fr); gap: 20px; }
.link-list li { border-bottom: 1px solid var(--border); }
.link-list a {
  display: flex; align-items: center; gap: 8px; padding: 11px 4px;
  font-size: 13px; color: var(--text);
}
.link-list a:hover { color: var(--brand); }
.link-list a::after { content: "›"; margin-left: auto; color: var(--muted); }
.link-list .num {
  width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%;
  background: var(--brand-light); color: var(--brand); font-size: 12px; font-weight: 800; flex: none;
}

/* ---------- Latest reviews strip ---------- */
.review-strip { display: grid; grid-template-columns: repeat(6,1fr); gap: 12px; }
.rev-card { text-align: center; }
.rev-card .thumb { position: relative; }
.rev-card .new {
  position: absolute; top: 4px; left: 4px; background: var(--up); color: #fff;
  font-size: 9px; font-weight: 700; padding: 2px 5px; border-radius: 4px;
}
.rev-card img { aspect-ratio: 1; object-fit: contain; background: var(--bg); border-radius: 8px; }
.rev-card .ttl { font-size: 11px; font-weight: 600; line-height: 1.4; margin-top: 6px; }
.rev-card .date { font-size: 10px; color: var(--muted); }

/* ---------- Footer ---------- */
.footer { background: #0d1526; color: #c5cdda; padding: 40px 0 24px; margin-top: 40px; }
:root[data-theme="dark"] .footer { background: #070b14; }
.footer__top { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr; gap: 28px; }
.footer__brand .logo__name { color: #fff; }
.footer__brand p { font-size: 12px; opacity: .8; margin-top: 12px; line-height: 1.8; }
.footer h4 { font-size: 13px; color: #fff; margin: 0 0 12px; }
.footer__col a { display: block; font-size: 12px; padding: 5px 0; opacity: .82; }
.footer__col a:hover { opacity: 1; color: #fff; }
.footer__kw { display: flex; flex-wrap: wrap; gap: 6px; }
.footer__kw a { background: rgba(255,255,255,.08); padding: 5px 10px; border-radius: 6px; opacity: .85; }
.footer__social { display: flex; gap: 14px; margin-top: 18px; font-size: 18px; }
.footer__copy { text-align: center; font-size: 11px; opacity: .6; margin-top: 30px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.1); }

/* ---------- Compare bar ---------- */
body.has-compare-bar { padding-bottom: 68px; }
.compare-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: var(--card); border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(20,30,50,.12);
  transform: translateY(100%); transition: transform .25s ease;
}
.compare-bar.is-visible { transform: translateY(0); }
.compare-bar__inner { display: flex; align-items: center; gap: 16px; padding: 10px 16px; }
.compare-bar__items { display: flex; gap: 8px; flex: 1; overflow-x: auto; }
.compare-bar__item { position: relative; width: 44px; height: 44px; flex: 0 0 auto; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.compare-bar__item img { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }
.compare-bar__item button {
  position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--muted); color: #fff; border: none; font-size: 11px; line-height: 18px; cursor: pointer; padding: 0;
}
.compare-bar__actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.compare-bar__count { font-size: 12px; color: var(--muted); white-space: nowrap; }
.compare-bar__clear {
  font-size: 12px; color: var(--muted); background: none; border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 12px; cursor: pointer; white-space: nowrap;
}
.compare-bar__clear:hover { border-color: var(--brand); color: var(--brand); }
.compare-bar__go { display: inline-block; padding: 8px 20px; white-space: nowrap; }
.compare-bar__go.is-disabled { pointer-events: none; opacity: .5; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; }
  .hero__rank-grid { grid-template-columns: repeat(3,1fr); }
  .with-side { grid-template-columns: 1fr; }
  .rank-list { grid-template-columns: repeat(3,1fr); }
  .cat-grid { grid-template-columns: repeat(4,1fr); }
  .feature-grid { grid-template-columns: 1fr 1fr; }
  .quad { grid-template-columns: 1fr 1fr; }
  .review-strip { grid-template-columns: repeat(3,1fr); }
  .footer__top { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .header .container { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 10px; }
  .search { order: 3; max-width: 100%; flex-basis: 100%; }
  .header__actions .header__action span { display: none; }
  .hamburger { display: block; }
  .nav { top: 0; }
  .two-col { grid-template-columns: 1fr; }
  .two-col > div + div { border-left: none; padding-left: 0; }
  .hero__rank-grid, .rank-list, .cat-grid, .feature-grid, .quad, .review-strip { grid-template-columns: 1fr 1fr; }
  .topbar__left { display: none; }
  .compare-bar__inner { gap: 8px; padding: 8px 12px; }
  .compare-bar__items { gap: 6px; }
  .compare-bar__count { display: none; }
  .compare-bar__go { padding: 8px 14px; font-size: 12px; }
}
