:root {
  --display-font: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  --ui-font: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  --text: #102028;
  --muted: #5f7079;
  --accent: #1b8c81;
  --accent-strong: #0f6d65;
  --warn: #de8740;
  --line: rgba(16, 32, 40, 0.08);
  --surface: rgba(255, 255, 255, 0.58);
  --surface-strong: rgba(255, 255, 255, 0.76);
  --shadow: 0 24px 64px rgba(13, 45, 49, 0.12);
  --pill-shadow: 0 10px 24px rgba(15, 109, 101, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  font-family: var(--ui-font);
  font-weight: 500;
  color: var(--text);
  background:
    radial-gradient(circle at left top, rgba(97, 210, 181, 0.12), transparent 24%),
    radial-gradient(circle at right top, rgba(27, 140, 129, 0.09), transparent 28%),
    linear-gradient(180deg, #edf6f7 0%, #e1edef 100%);
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.page-shell {
  width: min(calc(100% - 24px), 1440px);
  margin: 0 auto;
  padding: 18px 0 40px;
}

.masthead,
.sticky-nav,
.feed-panel,
.side-panel {
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  padding: 0;
  border-radius: 28px;
  overflow: hidden;
}

.masthead-media {
  width: 100%;
}

.masthead-image-slot {
  display: block;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 32 / 11;
  border-radius: inherit;
  line-height: 0;
  background: #eaf6f8;
}

.masthead-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.feed-meta,
.ranking-item p,
.panel-summary {
  color: var(--muted);
}

.panel-head h2 {
  margin: 0;
  font-family: var(--display-font);
  font-weight: 700;
  line-height: 1.2;
}

.panel-head h1 {
  margin: 0;
  font-family: var(--display-font);
  font-size: clamp(1.45rem, 3vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
}

.panel-title-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 10px 0 12px;
  border: 1px solid rgba(15, 109, 101, 0.14);
  border-radius: 999px;
  background: rgba(27, 140, 129, 0.08);
  color: var(--accent-strong);
  box-shadow: 0 6px 16px rgba(15, 109, 101, 0.08);
  transition: color 140ms ease, transform 140ms ease, background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.panel-title-link::after {
  content: "";
  width: 7px;
  height: 7px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
}

.panel-title-link:hover {
  border-color: rgba(15, 109, 101, 0.24);
  background: rgba(27, 140, 129, 0.14);
  transform: translateY(-1px);
  box-shadow: var(--pill-shadow);
}

.panel-title-link:focus-visible {
  outline: 3px solid rgba(27, 140, 129, 0.24);
  outline-offset: 3px;
}

.feed-title,
.ranking-item h3,
.featured-item,
.pagination-link,
.tab-button {
  font-weight: 700;
}

.tab-button,
.pagination-link,
.featured-item {
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: transform 140ms ease, background-color 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.tab-button:hover,
.pagination-link:hover,
.featured-item:hover {
  transform: translateY(-1px);
}

.sticky-nav {
  position: sticky;
  top: 12px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 12px;
  border-radius: 22px;
}

.category-tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.tab-button {
  flex: 0 0 auto;
  padding: 11px 16px;
  background: var(--surface-strong);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}

.tab-button[data-category="it"] {
  min-width: 46px;
}

.tab-button.is-active {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: var(--pill-shadow);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(320px, 0.95fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.single-layout {
  display: block;
  margin-top: 18px;
}

.feed-panel,
.side-panel {
  border-radius: 26px;
}

.feed-panel {
  padding: 20px;
}

.side-panel {
  padding: 18px;
}

.ranking-panel {
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
}

.ranking-panel .panel-head {
  padding: 18px 18px 0;
  margin-bottom: 0;
}

.ranking-panel .ranking-list {
  gap: 0;
}

.ranking-panel .ranking-item {
  padding-left: 18px;
  padding-right: 18px;
  border-left: 0;
  border-right: 0;
  border-radius: 0;
  background: transparent;
}

.ranking-panel .ranking-item:first-child {
  border-top: 1px solid var(--line);
}

.sidebar-column {
  display: grid;
  gap: 18px;
  align-content: start;
  align-items: start;
}

.side-panel {
  align-self: start;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: end;
  margin-bottom: 14px;
}

.panel-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.92rem;
}

.feed-list {
  display: grid;
}

.feed-empty-state {
  padding: 24px 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.8;
}

.feed-item {
  display: block;
  padding: 10px 8px;
  border-top: 1px solid var(--line);
}

.feed-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.feed-item:nth-child(even) {
  background: rgba(255, 255, 255, 0.12);
}

.feed-main {
  display: grid;
  grid-template-columns: 48px 86px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-width: 0;
  color: inherit;
}

.feed-content {
  min-width: 0;
}

.feed-thumbnail-link,
.feed-content-link {
  display: block;
  min-width: 0;
}

.time-badge,
.category-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.time-badge {
  margin-top: 2px;
  background: rgba(27, 140, 129, 0.1);
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 700;
}

.feed-thumbnail {
  width: 86px;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-strong);
  object-fit: cover;
}

.feed-title {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.42;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.feed-meta {
  margin: 3px 0 0;
  font-size: 0.84rem;
  line-height: 1.35;
}

.feed-tags {
  display: flex;
  flex-wrap: wrap;
  align-content: start;
  justify-content: start;
  gap: 4px;
  margin-top: 5px;
}

.category-pill {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 700;
}

a.category-pill:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 109, 101, 0.18);
  box-shadow: var(--pill-shadow);
}

.ranking-list,
.featured-list {
  display: grid;
  gap: 12px;
}

.keyword-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ranking-empty-state {
  padding: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.7;
}

.ranking-item {
  display: grid;
  grid-template-columns: 34px 72px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-strong);
}

.ranking-content {
  min-width: 0;
}

.ranking-item h3 {
  margin: 0 0 6px;
  font-size: 0.97rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.ranking-item p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
}

.rank-badge {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-weight: 700;
  box-shadow: var(--pill-shadow);
}

.ranking-thumbnail {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(97, 210, 181, 0.18), rgba(27, 140, 129, 0.06)),
    var(--surface-strong);
  object-fit: cover;
}

.featured-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--surface-strong);
}

.keyword-list .featured-item {
  min-width: 0;
  padding: 10px 12px;
}

.featured-rank {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.82rem;
  box-shadow: var(--pill-shadow);
}

.keyword-list .featured-rank {
  width: 26px;
  height: 26px;
  font-size: 0.78rem;
}

.featured-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.featured-item.is-active {
  border-color: transparent;
  background: linear-gradient(135deg, rgba(27, 140, 129, 0.18), rgba(15, 109, 101, 0.28));
  color: var(--accent-strong);
  font-weight: 700;
}

.pagination-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 42px;
  padding: 0 14px;
  background: var(--surface-strong);
  color: var(--muted);
}

.pagination-link.is-active {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: var(--pill-shadow);
}

.keyword-index-panel {
  max-width: 960px;
  margin: 0 auto;
}

.keyword-index-head {
  align-items: center;
}

.keyword-index-head .panel-summary {
  margin: 8px 0 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--accent-strong);
  font-weight: 700;
  white-space: nowrap;
}

.keyword-index-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.keyword-index-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-strong);
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.keyword-index-item:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 109, 101, 0.18);
  box-shadow: var(--pill-shadow);
}

.keyword-index-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.keyword-index-count {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.mobile-ranking-panel {
  display: block;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .feed-panel {
    order: 1;
  }

  .secondary-sidebar {
    display: contents;
  }

  .ranking-panel {
    order: 0;
  }

  .secondary-sidebar > .side-panel:not(.ranking-panel) {
    order: 2;
  }

  .panel-head {
    align-items: start;
  }

  .mobile-ranking-panel {
    display: block;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: 100%;
    padding: 10px 8px 32px;
    overflow-x: visible;
  }

  .masthead,
  .sticky-nav,
  .layout {
    width: 100%;
    max-width: 100%;
  }

  .layout {
    gap: 12px;
    margin-top: 12px;
  }

  .single-layout {
    margin-top: 12px;
  }

  .sticky-nav {
    top: 0;
    margin-top: 0;
    padding: 10px;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }

  .category-tabs {
    gap: 8px;
    width: 100%;
    padding-bottom: 2px;
  }

  .tab-button {
    min-width: auto;
    padding: 9px 12px;
    font-size: 0.86rem;
  }

  .tab-button[data-category="it"] {
    min-width: 40px;
  }

  .masthead,
  .feed-panel,
  .side-panel {
    border-radius: 22px;
  }

  .masthead {
    padding: 0;
  }

  .feed-panel {
    padding: 14px 10px;
  }

  .side-panel {
    padding: 16px;
  }

  .ranking-panel {
    padding-top: 0;
    padding-bottom: 0;
  }

  .ranking-panel .panel-head {
    padding: 16px 16px 0;
  }

  .ranking-panel .ranking-item {
    padding-left: 12px;
    padding-right: 12px;
  }

  .panel-head {
    display: grid;
  }

  .keyword-index-head {
    gap: 12px;
  }

  .back-link {
    width: fit-content;
    min-height: 38px;
    padding: 0 14px;
  }

  .keyword-index-item {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 10px;
    border-radius: 15px;
  }

  .feed-item {
    padding: 8px 0;
  }

  .feed-main {
    grid-template-columns: 40px 62px minmax(0, 1fr);
    gap: 7px;
  }

  .time-badge {
    min-height: 22px;
    padding: 0 5px;
    font-size: 0.68rem;
  }

  .feed-thumbnail {
    width: 62px;
    height: 46px;
    border-radius: 10px;
  }

  .feed-title {
    font-size: 0.86rem;
    line-height: 1.35;
  }

  .feed-meta {
    margin-top: 2px;
    font-size: 0.74rem;
    line-height: 1.25;
  }

  .feed-tags {
    gap: 3px;
    margin-top: 4px;
  }

  .category-pill {
    min-height: 20px;
    padding: 0 6px;
    font-size: 0.68rem;
  }

  .keyword-list {
    gap: 8px;
  }

  .keyword-list .featured-item {
    gap: 7px;
    padding: 9px 10px;
  }

  .keyword-list .featured-rank {
    width: 24px;
    height: 24px;
    font-size: 0.72rem;
  }

  .ranking-item {
    grid-template-columns: 28px 52px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
  }

  .ranking-item h3 {
    margin-bottom: 4px;
    font-size: 0.84rem;
    line-height: 1.4;
  }

  .ranking-item p {
    font-size: 0.72rem;
  }

  .rank-badge {
    width: 28px;
    height: 28px;
    font-size: 0.78rem;
  }

  .ranking-thumbnail {
    width: 52px;
    height: 52px;
    border-radius: 12px;
  }

}
