/* ===== Reset & Variables ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-page: #2C3E50;
  --bg-panel-a: #EAECEE;
  --bg-panel-b: #F5F0E6;
  --bg-card: #FFFFFF;
  --card-orange: #E67E22;
  --card-yellow: #F1C40F;
  --card-green: #2ECC71;
  --card-blue: #3498DB;
  --accent-new: #FF6B9D;
  --status-update: #27AE60;
  --status-old: #D35400;
  --status-featured: #9B59B6;
  --text-dark: #2C3E50;
  --text-light: #ECF0F1;
  --text-muted: #71808D;
  --line: #BDC3C7;
  --font-head: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --radius: 0px;
  --shadow-card: 0 2px 0 rgba(44, 62, 80, 0.06);
  --shadow-lift: 0 6px 0 rgba(44, 62, 80, 0.10);
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  background: var(--bg-page);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a {
  color: var(--card-blue);
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 800;
  line-height: 1.25;
  color: var(--text-dark);
}

:focus-visible {
  outline: 3px solid var(--accent-new);
  outline-offset: 2px;
}

::selection {
  background: var(--card-yellow);
  color: var(--text-dark);
}

/* ===== Accessibility ===== */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 300;
  transform: translateX(-50%) translateY(-160%);
  background: var(--card-yellow);
  color: var(--text-dark);
  font-weight: 700;
  text-decoration: none;
  padding: 10px 20px;
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s ease;
}

.skip-link:focus {
  transform: translateX(-50%) translateY(0);
}

/* ===== Scroll Progress ===== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--card-yellow), var(--accent-new));
  z-index: 400;
  pointer-events: none;
}

/* ===== Header ===== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  padding: 12px 16px 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.header-inner {
  position: relative;
  max-width: 1280px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(27, 38, 48, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 999px;
  padding: 8px 10px 8px 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  pointer-events: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-light);
  flex-shrink: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--card-orange), var(--accent-new));
  color: #ffffff;
  font-weight: 800;
  font-size: 19px;
  border-radius: 8px;
  transform: skewX(-4deg);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}

.brand-name {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.04em;
  transform: skewX(-2deg);
  white-space: nowrap;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-light);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.site-nav a:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.site-nav a[aria-current="page"] {
  background: var(--accent-new);
  color: #ffffff;
}

.site-nav a[aria-current="page"]:hover {
  background: var(--accent-new);
  color: #ffffff;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 9px;
  background: transparent;
  border: 1px solid rgba(236, 240, 241, 0.45);
  border-radius: 12px;
  cursor: pointer;
  flex-shrink: 0;
}

.nav-toggle-bar {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-light);
  border-radius: 2px;
}

.nav-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ===== Back to Top ===== */
.back-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 150;
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;
  background: var(--card-blue);
  color: #ffffff;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s, background 0.15s ease;
}

.back-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-top:hover {
  background: var(--card-orange);
}

/* ===== Footer ===== */
.site-footer {
  background: #17232E;
  color: var(--text-light);
  flex-shrink: 0;
  margin-top: auto;
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px 32px;
  padding: 32px 0 24px;
  border-bottom: 1px solid rgba(236, 240, 241, 0.16);
}

.footer-brand .brand {
  color: var(--text-light);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
}

.footer-links a {
  color: rgba(236, 240, 241, 0.82);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.footer-links a:hover {
  color: var(--card-yellow);
  border-bottom-color: var(--card-yellow);
}

.footer-contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: rgba(236, 240, 241, 0.82);
}

.footer-email,
.footer-tel {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.footer-meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding: 18px 0 26px;
  font-size: 13px;
  font-family: var(--font-mono);
  color: rgba(236, 240, 241, 0.58);
}

/* ===== Layout Basics ===== */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding-left: clamp(16px, 3vw, 32px);
  padding-right: clamp(16px, 3vw, 32px);
}

.main-content {
  flex: 1 0 auto;
  padding-top: 88px;
}

.panel {
  padding: clamp(40px, 6vw, 72px) clamp(16px, 4vw, 56px);
}

.panel--alt-a {
  background: var(--bg-panel-a);
  color: var(--text-dark);
}

.panel--alt-b {
  background: var(--bg-panel-b);
  color: var(--text-dark);
}

.panel--dark {
  background: var(--bg-page);
  color: var(--text-light);
}

.panel--dark .section-title,
.panel--dark h1,
.panel--dark h2,
.panel--dark h3 {
  color: var(--text-light);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-bottom: 22px;
  border-bottom: 3px solid var(--bg-page);
  padding-bottom: 10px;
}

.panel--dark .section-head {
  border-bottom-color: rgba(236, 240, 241, 0.28);
}

.section-title {
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 800;
  transform: skewX(-2deg);
  letter-spacing: 0.02em;
}

.eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--card-orange);
}

.panel--dark .eyebrow {
  color: var(--card-yellow);
}

/* ===== Breadcrumbs ===== */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  margin-bottom: 18px;
  color: var(--text-muted);
}

.breadcrumbs a {
  color: var(--card-blue);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--status-featured);
  text-decoration: underline;
}

.breadcrumbs span[aria-current="page"] {
  color: var(--text-dark);
  font-weight: 700;
}

.panel--dark .breadcrumbs span[aria-current="page"] {
  color: var(--text-light);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  border: 2px solid transparent;
  border-radius: 4px;
  background: var(--card-blue);
  color: #ffffff;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.btn:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text-dark);
}

.btn--ghost:hover {
  background: rgba(44, 62, 80, 0.06);
  filter: none;
}

.panel--dark .btn--ghost {
  border-color: rgba(236, 240, 241, 0.4);
  color: var(--text-light);
}

.panel--dark .btn--ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ===== Card Grid ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--card-blue);
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
}

.card--orange {
  border-top-color: var(--card-orange);
}

.card--yellow {
  border-top-color: var(--card-yellow);
}

.card--green {
  border-top-color: var(--card-green);
}

.card--blue {
  border-top-color: var(--card-blue);
}

.card-title {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.3;
  transform: skewX(-2deg);
}

.card-title a {
  color: var(--text-dark);
  text-decoration: none;
}

.card-title a:hover {
  color: var(--card-blue);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== Tile Matrix ===== */
.tile-matrix {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 96px;
  padding: 14px;
  background: var(--card-orange);
  color: #ffffff;
  border: none;
  border-bottom: 3px solid rgba(0, 0, 0, 0.14);
  text-decoration: none;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.tile:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
}

.tile:nth-child(4n + 2) {
  background: var(--card-yellow);
  color: var(--text-dark);
  border-bottom-color: rgba(0, 0, 0, 0.14);
}

.tile:nth-child(4n + 3) {
  background: var(--card-green);
  color: var(--text-dark);
  border-bottom-color: rgba(0, 0, 0, 0.14);
}

.tile:nth-child(4n + 4) {
  background: var(--card-blue);
  color: #ffffff;
  border-bottom-color: rgba(0, 0, 0, 0.14);
}

.tile-label {
  font-weight: 800;
  font-size: 15px;
  line-height: 1.35;
}

.tile-count {
  font-family: var(--font-mono);
  font-size: 13px;
  opacity: 0.85;
}

/* ===== Entry List ===== */
.entry-list {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-top: 2px solid var(--bg-page);
}

.panel--dark .entry-list {
  border-top-color: rgba(236, 240, 241, 0.28);
}

.entry-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-card);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.entry-row:hover {
  background: var(--bg-panel-b);
  box-shadow: inset 4px 0 0 var(--card-orange);
}

.entry-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.entry-title {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.4;
}

.entry-title a {
  color: var(--text-dark);
  text-decoration: none;
}

.entry-title a:hover {
  color: var(--card-blue);
  text-decoration: underline;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== Tags ===== */
.tag-block {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-dark);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.tag:hover {
  border-color: var(--card-blue);
  background: rgba(52, 152, 219, 0.08);
  color: var(--card-blue);
}

.tag--orange {
  background: rgba(230, 126, 34, 0.1);
  border-color: rgba(230, 126, 34, 0.45);
  color: var(--card-orange);
}

.tag--yellow {
  background: rgba(241, 196, 15, 0.14);
  border-color: rgba(241, 196, 15, 0.6);
  color: #9A7D0A;
}

.tag--green {
  background: rgba(46, 204, 113, 0.1);
  border-color: rgba(46, 204, 113, 0.45);
  color: #1E8449;
}

.tag--blue {
  background: rgba(52, 152, 219, 0.1);
  border-color: rgba(52, 152, 219, 0.45);
  color: var(--card-blue);
}

/* ===== Status Badges ===== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 2px;
  background: var(--status-update);
  color: #ffffff;
  white-space: nowrap;
}

.status-badge--new {
  background: var(--accent-new);
}

.status-badge--update {
  background: var(--status-update);
}

.status-badge--old {
  background: var(--status-old);
}

.status-badge--featured {
  background: var(--status-featured);
}

/* ===== Num Mark ===== */
.num-mark {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 22px;
  line-height: 1;
  min-width: 2.2em;
  color: var(--card-blue);
}

.num-mark::after {
  content: ".";
  color: var(--card-orange);
}

/* ===== Meter ===== */
.meter-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(44, 62, 80, 0.14);
  overflow: hidden;
}

.meter-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--card-green);
}

.meter-fill--orange {
  background: var(--card-orange);
}

.meter-fill--accent {
  background: var(--accent-new);
}

/* ===== Index Bar ===== */
.indexbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.indexbar a,
.indexbar span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text-dark);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.indexbar a:hover {
  background: var(--card-yellow);
  border-color: var(--card-yellow);
}

.indexbar span {
  background: var(--bg-panel-a);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* ===== Horizontal Scroll ===== */
.h-scroll {
  overflow-x: auto;
  padding: 4px 4px 12px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.h-scroll-track {
  display: flex;
  gap: 14px;
  min-width: max-content;
}

.h-scroll-track > * {
  scroll-snap-align: start;
  width: 240px;
  flex-shrink: 0;
}

/* ===== Data Table ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--bg-card);
}

.data-table th,
.data-table td {
  border: 1px solid var(--line);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: var(--bg-page);
  color: var(--text-light);
  font-weight: 700;
  font-family: var(--font-head);
}

.data-table th[scope="row"],
.data-table td:first-child {
  font-family: var(--font-mono);
  font-weight: 600;
}

.data-table tbody tr:nth-child(even) td {
  background: var(--bg-panel-a);
}

.data-table tbody tr:hover td {
  background: var(--bg-panel-b);
}

/* ===== Visual Placeholder ===== */
.visual-placeholder {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  width: 100%;
  min-height: 120px;
  background: var(--bg-panel-a);
  border: 1px solid var(--line);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.visual-placeholder::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(44, 62, 80, 0.07) 25%, transparent 25%) 0 0 / 12px 12px,
    linear-gradient(315deg, rgba(44, 62, 80, 0.07) 25%, transparent 25%) 0 0 / 12px 12px;
  pointer-events: none;
}

.visual-placeholder--wide {
  aspect-ratio: 16 / 9;
}

.visual-placeholder--tall {
  aspect-ratio: 3 / 4;
}

.visual-placeholder img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .header-inner {
    border-radius: 24px;
    padding-left: 16px;
    padding-right: 8px;
  }

  .nav-toggle {
    display: flex;
  }

  .site-nav {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    background: rgba(23, 32, 42, 0.98);
    border-radius: 16px;
    padding: 10px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  }

  .site-nav[data-open="true"] {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .site-nav a {
    display: block;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 15px;
  }

  .footer-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 20px;
  }

  .main-content {
    padding-top: 84px;
  }
}

@media (max-width: 600px) {
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: 10px;
  }

  .tile-matrix {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }

  .entry-row {
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .footer-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .brand-name {
    font-size: 16px;
  }

  .back-top {
    right: 14px;
    bottom: 14px;
    width: 42px;
    height: 42px;
    font-size: 20px;
  }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
