:root {
  color-scheme: light;
  --page-bg:
    radial-gradient(circle at top left, rgba(101, 176, 204, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 160, 100, 0.14), transparent 24%),
    linear-gradient(180deg, #edf6f7 0%, #e1edef 100%);
  --shell-bg: rgba(255, 255, 255, 0.76);
  --surface: rgba(255, 255, 255, 0.84);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --line: rgba(27, 46, 54, 0.12);
  --text: #102028;
  --muted: #5f7079;
  --accent: #1b8c81;
  --accent-strong: #0f6d65;
  --accent-soft: rgba(27, 140, 129, 0.12);
  --warn: #de8740;
  --chip-bg: rgba(16, 32, 40, 0.05);
  --item-bg: rgba(16, 32, 40, 0.04);
  --thumb-size: 76px;
  --shadow: 0 24px 64px rgba(25, 47, 56, 0.12);
  --display-font: "Yu Mincho", "Hiragino Mincho ProN", serif;
  --ui-font: "Yu Gothic UI", "Hiragino Sans", "Meiryo", sans-serif;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --page-bg:
    radial-gradient(circle at top left, rgba(65, 163, 204, 0.2), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 151, 97, 0.16), transparent 22%),
    linear-gradient(180deg, #071119 0%, #0c1820 58%, #0f1c24 100%);
  --shell-bg: rgba(10, 20, 28, 0.76);
  --surface: rgba(10, 20, 28, 0.84);
  --surface-strong: rgba(12, 24, 33, 0.92);
  --line: rgba(174, 216, 227, 0.14);
  --text: #e6f3f2;
  --muted: #95afb5;
  --accent: #61d2b5;
  --accent-strong: #2d8b86;
  --accent-soft: rgba(97, 210, 181, 0.14);
  --warn: #f2a65b;
  --chip-bg: rgba(230, 243, 242, 0.06);
  --item-bg: rgba(230, 243, 242, 0.05);
  --thumb-size: 76px;
  --shadow: 0 26px 72px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-bg);
  color: var(--text);
  font-family: var(--ui-font);
}

button {
  font: inherit;
}

.page-shell {
  width: min(calc(100% - 24px), 1440px);
  margin: 14px auto 32px;
  transition: transform 320ms ease, filter 320ms ease;
}

.masthead {
  display: grid;
  gap: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0)),
    var(--shell-bg);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.masthead-hero {
  overflow: hidden;
  border-radius: 0;
  border: 0;
  background: transparent;
}

.masthead-hero img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1600 / 420;
  object-fit: cover;
}

.masthead-hero-link {
  display: block;
  width: 100%;
}

.masthead-hero-link:hover .masthead-hero {
  border-color: rgba(97, 210, 181, 0.26);
}

.brand-kicker,
.panel-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 700;
}

.brand-block h1,
.panel-head h2 {
  margin: 0;
}

.brand-block h1 {
  font-family: var(--display-font);
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
}

.brand-link {
  display: inline-block;
  color: inherit;
  text-decoration: none;
  width: fit-content;
}

.brand-link:hover .brand-block h1 {
  color: var(--accent);
}

.item-meta,
.slot-meta {
  color: var(--muted);
}

.sticky-nav {
  position: sticky;
  top: 12px;
  z-index: 30;
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0)),
    var(--surface-strong);
  backdrop-filter: blur(18px);
  box-shadow: 0 14px 38px rgba(14, 27, 34, 0.14);
}

.header-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.category-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  align-items: center;
  padding-bottom: 2px;
}

@media (min-width: 721px) {
  .category-tabs {
    cursor: grab;
    user-select: none;
  }

  .category-tabs.is-dragging {
    cursor: grabbing;
  }

  .category-tabs.is-dragging .tab-button {
    pointer-events: none;
  }
}

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

.tab-button,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--chip-bg);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.tab-button:hover,
.theme-toggle:hover {
  transform: translateY(-1px);
}

.tab-button.is-active,
.theme-toggle {
  border-color: rgba(97, 210, 181, 0.22);
}

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

.theme-toggle {
  gap: 8px;
  flex: 0 0 auto;
  background: linear-gradient(135deg, rgba(97, 210, 181, 0.16), rgba(242, 166, 91, 0.1));
  overflow: hidden;
}

.theme-icon {
  font-size: 1rem;
  line-height: 1;
  display: inline-block;
  transform-origin: center;
}

.theme-label {
  font-weight: 700;
}

.theme-toggle.is-switching {
  animation: theme-toggle-bounce 360ms ease;
}

.theme-toggle.is-switching .theme-icon {
  animation: theme-icon-spin 420ms ease;
}

.theme-toggle.is-switching .theme-label {
  animation: theme-label-fade 320ms ease;
}

.page-shell.is-theme-animating {
  animation: page-theme-shift 360ms ease;
}

.header-ad-slot,
.feed-panel,
.side-panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 44px rgba(14, 27, 34, 0.12);
}

.category-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
}

.header-ad-slot {
  margin-top: 16px;
  padding: 14px 16px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) minmax(300px, 0.72fr);
  grid-template-areas: "feed sidebar";
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.feed-panel {
  grid-area: feed;
  padding: 20px;
}

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

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

.panel-head.compact {
  margin-bottom: 14px;
}

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

.pagination-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  justify-content: center;
}

.pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--chip-bg);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.pagination-link:hover {
  transform: translateY(-1px);
  border-color: rgba(97, 210, 181, 0.26);
}

.pagination-link.is-active {
  border-color: rgba(97, 210, 181, 0.3);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
}

.pagination-link-arrow {
  min-width: 72px;
}

.feed-list {
  gap: 0;
}

.ranking-list {
  gap: 0;
}

.sidebar-column {
  display: grid;
  gap: 12px;
}

.secondary-sidebar {
  grid-area: sidebar;
  align-self: start;
}

.feed-item,
.featured-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  background: var(--item-bg);
  width: 100%;
  border: 1px solid transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.featured-item:hover {
  transform: translateY(-1px);
  border-color: rgba(97, 210, 181, 0.24);
}

.featured-item.is-active {
  border-color: rgba(97, 210, 181, 0.34);
  background: linear-gradient(135deg, rgba(97, 210, 181, 0.12), rgba(242, 166, 91, 0.06));
}

.feed-item {
  grid-template-columns: auto var(--thumb-size) minmax(0, 1fr);
  align-items: start;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  box-shadow: none;
}

.feed-list > .feed-item:first-child,
.feed-list > .ad-slot:first-child {
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
}

.feed-list > .feed-item:last-child,
.feed-list > .ad-slot:last-child {
  border-bottom: 0;
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 18px;
}

.feed-list > .feed-item:nth-child(odd) {
  background: rgba(255, 255, 255, 0.015);
}

body[data-theme="dark"] .feed-list > .feed-item:nth-child(odd) {
  background: rgba(230, 243, 242, 0.018);
}

body:not([data-theme="dark"]) .feed-list > .feed-item:nth-child(odd) {
  background: rgba(16, 32, 40, 0.02);
}

.feed-item.has-thumbnail {
  grid-template-columns: auto var(--thumb-size) minmax(0, 1fr);
}

.time-badge {
  min-width: 56px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 12px;
  background: rgba(242, 166, 91, 0.16);
  color: var(--warn);
  font-size: 0.78rem;
  font-weight: 700;
}

.time-badge.is-empty {
  visibility: hidden;
}

.feed-main {
  display: grid;
  gap: 6px;
  min-width: 0;
  align-content: start;
}

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

.feed-title-link:hover .feed-title {
  color: var(--accent);
}

.feed-title,
.featured-item strong,
.ad-native-title,
.ad-banner-headline {
  font-size: 0.96rem;
  line-height: 1.6;
  font-weight: 700;
}

.feed-item .feed-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  line-height: 1.5;
  max-height: calc(1.5em * 2);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.feed-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.feed-item .feed-meta {
  gap: 5px 6px;
}

.feed-item .item-meta {
  min-width: 0;
  max-width: 100%;
  font-size: 0.78rem;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-item .category-pill {
  min-height: 24px;
  padding: 0 10px;
  font-size: 0.72rem;
  line-height: 1;
}

.feed-thumbnail {
  width: var(--thumb-size);
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--item-bg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  display: grid;
  place-items: center;
}

.feed-thumbnail-link {
  text-decoration: none;
}

.feed-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.feed-thumbnail img.is-fallback-image,
.ranking-thumbnail img.is-fallback-image {
  object-fit: cover;
  background:
    linear-gradient(135deg, rgba(97, 210, 181, 0.08), rgba(242, 166, 91, 0.06)),
    var(--item-bg);
}

.feed-thumbnail.is-empty {
  background:
    linear-gradient(135deg, rgba(97, 210, 181, 0.08), rgba(242, 166, 91, 0.06)),
    var(--item-bg);
}

.feed-thumbnail-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: var(--chip-bg);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.side-panel {
  padding: 16px;
}

.ranking-item {
  display: grid;
  grid-template-columns: auto 52px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  min-width: 0;
}

.ranking-list > .ranking-item:first-child {
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
}

.ranking-list > .ranking-item:last-child {
  border-bottom: 0;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 14px;
}

.ranking-list > .ranking-item:nth-child(odd) {
  background: rgba(255, 255, 255, 0.015);
}

body[data-theme="dark"] .ranking-list > .ranking-item:nth-child(odd) {
  background: rgba(230, 243, 242, 0.018);
}

body:not([data-theme="dark"]) .ranking-list > .ranking-item:nth-child(odd) {
  background: rgba(16, 32, 40, 0.02);
}

.ranking-item-link {
  color: inherit;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
  min-width: 0;
}

.ranking-item-link:hover {
  transform: translateY(-1px);
  background: rgba(97, 210, 181, 0.08);
}

.ranking-thumbnail {
  width: 46px;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--item-bg);
  display: grid;
  place-items: center;
}

.ranking-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ranking-thumbnail.is-empty {
  background:
    linear-gradient(135deg, rgba(97, 210, 181, 0.08), rgba(242, 166, 91, 0.06)),
    var(--item-bg);
}

.rank-badge {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--warn), var(--accent));
  color: #fff;
  font-size: 0.74rem;
  font-weight: 700;
}

.ranking-item .feed-title {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.category-pill {
  background: var(--chip-bg);
  color: var(--text);
}

.category-pill-link {
  text-decoration: none;
  transition: transform 160ms ease, background-color 160ms ease, color 160ms ease;
}

.category-pill-link:hover {
  transform: translateY(-1px);
  background: var(--accent-soft);
  color: var(--accent);
}

.ad-slot {
  border: 1px dashed var(--line);
  border-radius: 20px;
}

.ad-slot-content,
.ad-placeholder {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.ad-slot-content.native {
  background: linear-gradient(135deg, rgba(97, 210, 181, 0.12), rgba(242, 166, 91, 0.08));
  border-radius: inherit;
}

.ad-slot-content.banner {
  background: var(--item-bg);
  border-radius: inherit;
}

.ad-head,
.ad-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.ad-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(242, 166, 91, 0.16);
  color: var(--warn);
  font-size: 0.74rem;
  font-weight: 700;
}

.slot-meta {
  font-size: 0.76rem;
}

.ad-native-body,
.ad-banner-body,
.ad-placeholder {
  display: grid;
  gap: 8px;
}

.ad-banner-canvas {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 120px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(97, 210, 181, 0.14), rgba(18, 31, 40, 0.12));
  text-align: center;
}

.ad-cta {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
}

.ad-placeholder {
  color: var(--muted);
}

.ad-placeholder strong {
  color: var(--text);
}

.ad-slot.mobile-only {
  display: none;
}

@keyframes theme-toggle-bounce {
  0% {
    transform: translateY(0) scale(1);
  }
  35% {
    transform: translateY(-1px) scale(1.04);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes theme-icon-spin {
  0% {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(16deg) scale(1.22);
  }
  100% {
    transform: rotate(0deg) scale(1);
  }
}

@keyframes theme-label-fade {
  0% {
    opacity: 0.75;
    transform: translateY(2px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes page-theme-shift {
  0% {
    transform: scale(0.998);
    filter: saturate(0.96);
  }
  50% {
    transform: scale(1);
    filter: saturate(1.04);
  }
  100% {
    transform: scale(1);
    filter: saturate(1);
  }
}

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

  .sticky-nav {
    top: 8px;
  }

  .header-tools {
    grid-template-columns: 1fr;
  }

  .theme-toggle {
    justify-self: end;
  }
}

@media (max-width: 720px) {
  .layout {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-top: 12px;
  }

  .mobile-ranking-panel {
    display: block;
    order: 1;
    width: 100%;
  }

  .feed-panel {
    order: 2;
    width: 100%;
  }

  .secondary-sidebar {
    order: 3;
    width: 100%;
  }

  .sidebar-column {
    width: 100%;
  }

  .secondary-sidebar .ranking-panel {
    display: none;
  }

  .page-shell {
    width: min(calc(100% - 8px), 1440px);
    margin-top: 4px;
    margin-bottom: 16px;
  }

  .masthead,
  .sticky-nav,
  .feed-panel,
  .side-panel,
  .header-ad-slot {
    border-radius: 18px;
  }

  .sticky-nav,
  .feed-panel,
  .side-panel,
  .header-ad-slot {
    padding-left: 12px;
    padding-right: 12px;
  }

  .masthead {
    padding-top: 0;
    padding-bottom: 0;
  }

  .masthead-hero {
    border-radius: 0;
  }

  .sticky-nav {
    margin-top: 8px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .header-tools {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
  }

  .category-tabs {
    min-width: 0;
    scroll-snap-type: x proximity;
    padding-top: 1px;
    padding-bottom: 1px;
    mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
  }

  .tab-button {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 0 10px;
    font-size: 0.78rem;
    white-space: nowrap;
    scroll-snap-align: start;
  }

  .theme-toggle {
    flex: 0 0 auto;
    width: auto;
    min-height: 32px;
    padding: 0 10px;
    justify-content: center;
    font-size: 0.78rem;
    gap: 5px;
    margin-left: 0;
  }

  .theme-icon {
    font-size: 0.82rem;
  }

  .theme-label {
    font-size: 0.76rem;
  }

  .brand-kicker,
  .panel-kicker {
    margin-bottom: 4px;
    font-size: 0.68rem;
  }

  .brand-block h1 {
    font-size: clamp(1.6rem, 7vw, 2rem);
  }

  .feed-item {
    grid-template-columns: auto 68px minmax(0, 1fr);
    gap: 8px;
    padding: 10px;
  }

  .feed-item.has-thumbnail {
    grid-template-columns: auto 68px minmax(0, 1fr);
  }

  .feed-thumbnail {
    width: 68px;
  }

  .feed-panel,
  .side-panel,
  .header-ad-slot {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .feed-panel .panel-head {
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 10px;
  }

  .feed-panel .panel-head > div {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
  }

  .feed-panel .panel-kicker {
    margin: 0;
  }

  .feed-title,
  .featured-item strong,
  .ad-native-title,
  .ad-banner-headline {
    font-size: 0.88rem;
    line-height: 1.5;
  }

  .feed-main {
    gap: 6px;
  }

  .feed-meta {
    gap: 6px;
  }

  .feed-item .item-meta {
    font-size: 0.72rem;
  }

  .feed-item .category-pill {
    min-height: 22px;
    padding: 0 8px;
    font-size: 0.68rem;
  }

  .time-badge {
    min-width: 48px;
    min-height: 30px;
    padding: 0 8px;
    font-size: 0.72rem;
    justify-self: start;
  }

  .ranking-item {
    grid-template-columns: auto 48px minmax(0, 1fr);
    gap: 8px;
    padding: 10px;
  }

  .rank-badge {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    font-size: 0.72rem;
  }

  .ranking-thumbnail {
    width: 48px;
    border-radius: 10px;
  }

  .featured-list,
  .ranking-list,
  .feed-list,
  .sidebar {
    gap: 8px;
  }

  .feed-list {
    gap: 0;
  }

  .ranking-list {
    gap: 0;
  }

  .featured-item {
    padding: 12px;
    gap: 8px;
  }

  .ad-slot.desktop-only {
    display: none;
  }

  .ad-slot.mobile-only {
    display: block;
  }
}

.admin-page .page-shell {
  width: min(calc(100% - 24px), 1240px);
}

.admin-masthead {
  gap: 10px;
}

.admin-session-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.admin-logout-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.admin-hero-copy {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.8;
  max-width: 720px;
}

.admin-login-shell {
  min-height: calc(100vh - 40px);
  display: grid;
  place-items: center;
}

.admin-login-card {
  width: min(100%, 520px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.admin-login-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.admin-stack {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.admin-tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-tab-button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.admin-tab-button:hover {
  transform: translateY(-1px);
  border-color: rgba(97, 210, 181, 0.26);
}

.admin-tab-button.is-active {
  border-color: rgba(97, 210, 181, 0.3);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
}

.admin-tab-panels {
  display: grid;
}

.admin-tab-panel {
  display: none;
}

.admin-tab-panel.is-active {
  display: block;
}

.admin-history-window-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.admin-history-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.admin-history-toolbar-copy {
  display: grid;
  gap: 4px;
}

.admin-history-current {
  display: grid;
  gap: 4px;
  justify-items: end;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--item-bg);
}

.admin-history-current strong {
  color: var(--accent);
  font-size: 1rem;
}

.admin-scheduler-card {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--item-bg);
}

.admin-scheduler-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.admin-scheduler-copy {
  display: grid;
  gap: 6px;
}

.admin-scheduler-copy h3 {
  margin: 0;
  font-size: 1rem;
}

.admin-scheduler-copy .panel-kicker {
  margin-bottom: 0;
}

.admin-scheduler-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.admin-scheduler-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-scheduler-note {
  margin: 0;
  color: var(--muted);
}

.admin-history-window-button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.admin-history-window-button.is-active {
  border-color: rgba(97, 210, 181, 0.3);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
}

.admin-history-window {
  display: none;
}

.admin-history-window.is-active {
  display: block;
}

.admin-history-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.admin-history-block {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.admin-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-history-head h3 {
  margin: 0;
  font-size: 1rem;
}

.admin-history-list {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.admin-history-matrix-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
  align-items: start;
}

.admin-history-matrix-block {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--item-bg);
}

.analytics-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.analytics-summary-card {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--item-bg);
}

.analytics-summary-card strong {
  font-size: 1.2rem;
}

.analytics-summary-sub {
  color: var(--muted);
  font-size: 0.9rem;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
  align-items: start;
}

.admin-history-table-wrap {
  overflow: auto;
  max-height: 420px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.admin-history-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
}

.admin-history-table th,
.admin-history-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  font-size: 0.88rem;
}

.admin-history-table thead th {
  color: var(--text);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.02);
  position: sticky;
  top: 0;
  z-index: 1;
}

.admin-history-table tbody tr:last-child th,
.admin-history-table tbody tr:last-child td {
  border-bottom: 0;
}

.history-table-meta {
  display: block;
  margin-top: 4px;
}

.admin-csv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.admin-csv-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--item-bg);
}

.admin-csv-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.admin-csv-head h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.admin-upload-form {
  display: grid;
  gap: 14px;
}

.admin-file-input {
  min-height: 52px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.admin-history-card {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--item-bg);
  min-width: 0;
}

.admin-history-main {
  display: grid;
  gap: 8px;
}

.admin-panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 44px rgba(14, 27, 34, 0.12);
  padding: 22px;
  min-width: 0;
}

.admin-panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-panel-head h2 {
  margin: 0;
}

.admin-list-count {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.admin-flash {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--item-bg);
}

.admin-flash-success {
  border-color: rgba(97, 210, 181, 0.32);
}

.admin-flash-error {
  border-color: rgba(242, 166, 91, 0.32);
}

.admin-flash-warning {
  border-color: rgba(242, 166, 91, 0.4);
  background: linear-gradient(135deg, rgba(242, 166, 91, 0.12), rgba(242, 166, 91, 0.04));
}

.admin-lock-notice {
  display: grid;
  gap: 6px;
}

.admin-lock-notice strong {
  color: var(--warn);
}

.admin-lock-text {
  color: var(--text);
  line-height: 1.6;
}

.source-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field-block {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.source-form .field-block:last-of-type,
.source-form .admin-submit {
  grid-column: 1 / -1;
}

.text-input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.admin-submit {
  width: fit-content;
  min-width: 150px;
}

.category-form {
  display: grid;
  gap: 14px;
}

.admin-reset-form {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.admin-inline-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.7;
}

.admin-category-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.admin-category-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--item-bg);
}

.admin-category-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.admin-list-panel {
  max-width: 1480px;
  margin-inline: auto;
}

.admin-source-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.admin-list-panel > .admin-source-filters + .admin-source-filters {
  display: none;
}

.admin-filter-button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.admin-filter-button.is-active {
  border-color: rgba(97, 210, 181, 0.3);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
}

.admin-source-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.admin-global-interval-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
  margin-bottom: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--item-bg);
}

.admin-global-interval-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.admin-global-interval-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-source-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  height: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--item-bg);
}

.admin-source-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.admin-source-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
}

.admin-source-title {
  font-size: 0.96rem;
  line-height: 1.4;
  word-break: break-word;
}

.admin-state-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.admin-state-pill.is-active {
  background: rgba(97, 210, 181, 0.12);
  color: var(--accent);
}

.admin-state-pill.is-paused {
  background: rgba(242, 166, 91, 0.14);
  color: var(--warn);
}

.admin-source-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
}

.admin-source-meta .item-meta {
  line-height: 1.45;
  word-break: break-word;
}

.admin-link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 2px;
}

.admin-link-list a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.admin-link-list a:hover {
  text-decoration: underline;
}

.admin-link-list .item-meta {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--chip-bg);
  line-height: 1.45;
}

.admin-actions {
  display: grid;
  gap: 8px;
  align-content: start;
  width: 100%;
}

.admin-action-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.admin-interval-input {
  width: 76px;
  min-height: 38px;
}

.admin-action-button {
  min-width: 76px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.admin-actions form {
  margin: 0;
}

.admin-actions .admin-action-row form {
  flex: 1 1 calc(33.333% - 6px);
  min-width: 0;
}

.admin-actions .admin-action-row .admin-action-button {
  width: 100%;
}

.admin-action-button:hover {
  transform: translateY(-1px);
  border-color: rgba(97, 210, 181, 0.26);
}

.admin-action-button.danger {
  border-color: rgba(242, 166, 91, 0.4);
  color: var(--warn);
}

.admin-empty-state {
  padding: 18px;
  border-radius: 18px;
  background: var(--item-bg);
  color: var(--muted);
}

.admin-empty-state-wide {
  width: 100%;
}

@media (min-width: 960px) {
  .admin-source-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1460px) {
  .admin-source-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1200px) {
  .admin-source-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1201px) {
  .admin-source-title {
    font-size: 0.96rem;
  }

  .admin-source-card {
    padding: 13px 14px;
  }

  .admin-global-interval-card {
    grid-template-columns: 1fr;
    align-items: start;
  }
}

.admin-empty-state strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
}

.admin-empty-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin-top: 10px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.site-footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 18px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0)),
    var(--surface);
  backdrop-filter: blur(18px);
}

.site-footer-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--chip-bg);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.site-footer-link:hover {
  transform: translateY(-1px);
  border-color: rgba(97, 210, 181, 0.26);
}

.static-layout {
  grid-template-columns: minmax(0, 920px);
  justify-content: center;
}

.static-panel {
  min-width: 0;
}

.static-page-body {
  display: grid;
  gap: 18px;
}

.static-page-lead {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.8;
}

.static-section {
  display: grid;
  gap: 10px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--item-bg);
}

.static-section h3 {
  margin: 0;
  font-size: 1rem;
}

.static-section p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.static-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.contact-panel {
  display: grid;
  gap: 18px;
}

.contact-form {
  display: grid;
  gap: 14px;
}

.contact-textarea {
  min-height: 180px;
  padding: 14px;
  resize: vertical;
}

.contact-flash {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--item-bg);
}

.contact-flash-success {
  border-color: rgba(97, 210, 181, 0.32);
}

.contact-flash-error {
  border-color: rgba(242, 166, 91, 0.32);
}

.contact-field-error {
  color: var(--warn);
  font-size: 0.85rem;
}

.contact-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.contact-status-form {
  display: grid;
  gap: 8px;
}

.contact-status-select {
  min-width: 120px;
  min-height: 38px;
}

.contact-admin-detail {
  margin-top: 8px;
}

.contact-admin-detail summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.84rem;
}

.contact-admin-body {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.8;
  white-space: normal;
  word-break: break-word;
}

@media (max-width: 920px) {
  .source-form {
    grid-template-columns: 1fr;
  }

  .admin-history-grid,
  .admin-history-matrix-grid,
  .analytics-summary-grid,
  .analytics-grid,
  .admin-csv-grid,
  .admin-source-list,
  .admin-category-card,
  .admin-source-card {
    grid-template-columns: 1fr;
  }

  .admin-actions {
    grid-template-columns: 1fr;
  }

  .admin-global-interval-form {
    flex-wrap: wrap;
  }

  .static-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .admin-page .page-shell {
    width: min(calc(100% - 14px), 1240px);
  }

  .admin-panel {
    padding: 18px 16px;
    border-radius: 20px;
  }

  .admin-panel-head {
    flex-direction: column;
    align-items: start;
    margin-bottom: 14px;
  }

  .admin-session-bar {
    flex-direction: column;
    align-items: start;
  }

  .admin-tab-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .admin-tab-nav::-webkit-scrollbar {
    display: none;
  }

  .admin-tab-button {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 14px;
    font-size: 0.86rem;
    white-space: nowrap;
  }

  .admin-source-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .admin-source-filters::-webkit-scrollbar {
    display: none;
  }

  .admin-history-window-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .admin-history-toolbar {
    flex-direction: column;
    align-items: start;
  }

  .admin-scheduler-head {
    flex-direction: column;
  }

  .admin-scheduler-actions {
    width: 100%;
  }

  .admin-history-current {
    width: 100%;
    justify-items: start;
  }

  .admin-history-window-nav::-webkit-scrollbar {
    display: none;
  }

  .admin-csv-head {
    flex-direction: column;
    align-items: start;
  }

  .admin-source-card {
    padding: 14px;
  }

  .admin-login-card {
    padding: 22px 18px;
    border-radius: 22px;
  }

  .admin-category-card {
    padding: 14px;
  }

  .admin-source-meta {
    flex-direction: column;
    gap: 6px;
  }

  .admin-history-list,
  .admin-history-table-wrap {
    max-height: 320px;
  }

  .site-footer-nav {
    justify-content: stretch;
    padding: 16px;
  }

  .site-footer-link {
    width: 100%;
  }

  .static-section {
    padding: 16px;
  }

  .contact-status-select {
    min-width: 0;
  }
}
