:root {
  --ink: #111;
  --paper: #fff;
  --page: #f6f7fb;
  --pink: #d22f7b;
  --yellow: #f8d965;
  --blue: #457b9d;
  --muted: #5a5c66;
  --gap: 10px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--page);
  color: #16171d;
  font-family: "M PLUS Rounded 1c", "Zen Maru Gothic", system-ui, sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
}

.site-header {
  background: var(--paper);
  border-bottom: 1px solid #d9deea;
}

.header-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: min(1180px, 100%);
  margin: 0 auto 8px;
  padding: 12px 16px 0;
}

.site-title a {
  color: var(--pink);
  font-size: clamp(22px, 4vw, 42px);
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
}

.source-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
  box-shadow: 3px 3px 0 var(--ink);
}

.source-button:hover {
  transform: translateY(-1px);
}

.cost-table {
  width: min(1180px, 100%);
  margin: 0 auto 12px;
  padding: 0 16px;
}

.cost-table .row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.cost-table .label {
  min-width: 52px;
  color: var(--muted);
  font-weight: 900;
}

.cost-table a {
  min-width: 58px;
  padding: 7px 10px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--yellow);
  color: #16171d;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
  box-shadow: 2px 2px 0 var(--ink);
}

.cost-table a.is-active,
.cost-table a:hover {
  background: var(--pink);
  color: var(--paper);
}

.ryuji-page {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px 16px 48px;
}

.ryuji-hero {
  display: grid;
  grid-template-columns: minmax(220px, 390px) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  margin: 0 0 16px;
}

.ryuji-hero-media,
.ryuji-hero-copy {
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow: 5px 5px 0 var(--ink);
}

.ryuji-hero-media {
  min-height: 220px;
  overflow: hidden;
  background: #1c2635;
}

.ryuji-hero-media img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 220px;
  object-fit: cover;
}

.ryuji-hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--paper);
  padding: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-weight: 900;
}

.ryuji-hero h1 {
  margin: 0;
  color: var(--pink);
  font-size: clamp(28px, 5vw, 54px);
  line-height: 1.08;
  letter-spacing: 0;
}

.ryuji-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.stat-tile {
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #f7fafc;
  padding: 9px 10px;
}

.stat-tile b {
  display: block;
  font-size: clamp(22px, 4vw, 34px);
  line-height: 1;
}

.stat-tile span {
  display: block;
  margin-top: 4px;
  color: #50515a;
  font-size: 12px;
  font-weight: 900;
}

.filter-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 280px) minmax(140px, 180px);
  gap: 10px;
  margin: 18px 0;
}

.search-box,
.select-box {
  display: grid;
  gap: 5px;
  color: #24252d;
  font-weight: 900;
}

.search-box input,
.select-box select {
  width: 100%;
  min-height: 44px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  padding: 0 12px;
  color: #16171d;
  font: inherit;
  letter-spacing: 0;
  box-shadow: 2px 2px 0 var(--ink);
}

.article-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin: 0 0 18px;
}

.article-button {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  width: 100%;
  padding: 7px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  text-align: left;
  cursor: pointer;
}

.article-button.is-active {
  background: var(--yellow);
}

.article-button img {
  width: 68px;
  height: 52px;
  object-fit: cover;
  border-radius: 6px;
  background: #e8ebf2;
}

.article-button b {
  display: block;
  font-size: 13px;
  line-height: 1.25;
}

.article-button span span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.rank-wrapper {
  width: 100%;
  overflow-x: auto;
}

.unit-rank-table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0 8px;
  background: transparent;
}

.unit-rank-table th,
.unit-rank-table td {
  padding: 0;
  border-style: solid;
  border-width: 3px;
  background: var(--paper);
}

.unit-rank-table th {
  width: 74px;
  border-right: 0;
  border-radius: 8px 0 0 8px;
  font-size: 28px;
  line-height: 1;
  text-align: center;
  vertical-align: middle;
  letter-spacing: 0;
}

.unit-rank-table td {
  border-left: 0;
  border-radius: 0 8px 8px 0;
}

.unit-cards {
  display: block;
  padding: 10px;
}

.ryuji-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.unit-card-link {
  display: block;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.ryuji-product-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 310px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  overflow: hidden;
  box-shadow: 2px 2px 0 rgba(17, 17, 17, .95);
}

.ryuji-product-card:hover {
  transform: translateY(-2px);
}

.product-image-link {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #f1f3f7;
  border-bottom: 2px solid var(--ink);
  overflow: hidden;
}

.product-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
  background: #fff;
}

.product-image-link.is-fallback .product-image {
  object-fit: cover;
  padding: 0;
}

.product-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 7px;
  padding: 10px;
}

.product-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 900;
  line-height: 1;
}

.product-date {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.unit-name {
  display: block;
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.product-meta {
  margin: 0;
  color: #4b5568;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.3;
}

.rating-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: auto;
}

.rating-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: #edf1f7;
  color: #293043;
  font-size: 11px;
  font-weight: 900;
}

.product-note {
  margin: 0;
  color: #555b69;
  font-size: 12px;
  line-height: 1.35;
}

.product-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.product-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  min-width: 58px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 0 8px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  box-shadow: 1px 1px 0 var(--ink);
}

.product-link:hover {
  transform: translateY(-1px);
}

.product-link-amazon {
  background: #f6b352;
}

.product-link-rakuten {
  background: #f76956;
  color: #fff;
}

.product-link-yahoo {
  background: #66a7ff;
  color: #fff;
}

.product-link-source {
  background: #edf1f7;
}

.rank-God,
.rank-SS,
.rank-S {
  border-color: #7b1fa2 !important;
  color: #7b1fa2 !important;
}

.rank-A {
  border-color: #e63946 !important;
  color: #e63946 !important;
}

.rank-B {
  border-color: var(--blue) !important;
  color: var(--blue) !important;
}

.rank-C {
  border-color: #2a9d8f !important;
  color: #2a9d8f !important;
}

.rank-D,
.rank-E,
.rank-F,
.rank-Z,
.rank-H {
  border-color: #8d99ae !important;
  color: #6c7280 !important;
}

.empty-state {
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  padding: 18px;
  font-weight: 900;
  text-align: center;
}

.site-footer {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 0 16px 28px;
}

.site-disclaimer {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.7;
}

@media (max-width: 820px) {
  .site-header {
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .header-top,
  .ryuji-hero,
  .filter-panel {
    grid-template-columns: 1fr;
  }

  .header-top {
    gap: 6px;
    margin-bottom: 6px;
    padding: 8px 8px 0;
  }

  .site-title a {
    font-size: 20px;
  }

  .source-button {
    display: none;
  }

  .cost-table {
    margin-bottom: 8px;
    padding: 0 8px;
  }

  .cost-table .row {
    gap: 4px;
  }

  .cost-table .label {
    min-width: 36px;
    font-size: 12px;
  }

  .cost-table a {
    min-width: 42px;
    padding: 5px 7px;
    border-radius: 6px;
    font-size: 12px;
    box-shadow: 1px 1px 0 var(--ink);
  }

  .ryuji-page {
    display: flex;
    flex-direction: column;
    padding: 8px 8px 32px;
  }

  .ryuji-hero {
    display: none;
  }

  .ryuji-rank-wrapper {
    order: 1;
  }

  .filter-panel {
    order: 2;
    gap: 8px;
    margin: 12px 0;
  }

  .article-strip {
    order: 3;
    display: flex;
    overflow-x: auto;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 2px;
  }

  .article-button {
    flex: 0 0 230px;
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .article-button img {
    width: 58px;
    height: 44px;
  }

  .search-box input,
  .select-box select {
    min-height: 38px;
    border-radius: 6px;
    font-size: 14px;
  }

  .ryuji-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .unit-rank-table {
    min-width: 0;
    border-spacing: 0 6px;
  }

  .unit-rank-table,
  .unit-rank-table tbody,
  .unit-rank-table tr,
  .unit-rank-table th,
  .unit-rank-table td {
    display: block;
    width: 100%;
  }

  .unit-rank-table th {
    border-right: 3px solid;
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    padding: 5px 8px;
    font-size: 20px;
  }

  .unit-rank-table td {
    border-left: 3px solid;
    border-radius: 0 0 8px 8px;
  }

  .unit-cards {
    padding: 7px;
  }

  .ryuji-product-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
    padding-bottom: 0;
  }

  .ryuji-product-card {
    display: flex;
    min-width: 0;
    min-height: 178px;
  }

  .product-image-link {
    height: 72px;
    min-height: 72px;
    aspect-ratio: auto;
    border-right: 0;
    border-bottom: 2px solid var(--ink);
  }

  .product-image {
    padding: 5px;
  }

  .product-card-body {
    gap: 4px;
    padding: 6px;
    min-width: 0;
  }

  .product-card-top {
    gap: 5px;
  }

  .tier-badge {
    min-width: 34px;
    height: 20px;
    padding: 0 6px;
    border-radius: 5px;
    font-size: 12px;
  }

  .product-date {
    font-size: 10px;
  }

  .unit-name {
    display: -webkit-box;
    font-size: 11px;
    line-height: 1.25;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .product-meta {
    font-size: 10px;
  }

  .rating-badges {
    gap: 3px;
    margin-top: 0;
  }

  .rating-chip {
    min-height: 18px;
    padding: 0 5px;
    font-size: 10px;
  }

  .rating-chip:nth-child(n+4) {
    display: none;
  }

  .product-note {
    display: none;
  }

  .product-links {
    gap: 4px;
  }

  .product-link {
    min-width: 34px;
    min-height: 20px;
    border-width: 1px;
    border-radius: 5px;
    padding: 0 4px;
    font-size: 10px;
    box-shadow: none;
  }
}
