:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --text: #172033;
  --muted: #68758b;
  --line: #dfe5ee;
  --primary: #2457d6;
  --primary-dark: #193f9f;
  --accent: #f0b429;
  --success: #16825d;
  --danger: #c43d4b;
  --shadow: 0 18px 50px rgba(28, 48, 84, 0.09);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-gutter: stable; background-color: #f8f9fa; }
@supports not (scrollbar-gutter: stable) { html { overflow-y: scroll; } }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.container { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.header-inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 46px; height: 46px; display: grid; place-items: center;
  border-radius: 14px; color: #fff; font-weight: 900; letter-spacing: -1px;
  background: linear-gradient(135deg, var(--primary), #6b8cff);
  box-shadow: 0 8px 20px rgba(36, 87, 214, 0.25);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 16px; }
.brand-text small { color: var(--muted); font-size: 11px; letter-spacing: 0.04em; }
.top-nav { display: flex; align-items: center; gap: 26px; color: var(--muted); font-size: 14px; }
.top-nav a { padding: 8px 0; border-bottom: 2px solid transparent; }
.top-nav a:hover, .top-nav a.active { color: var(--primary); border-color: var(--primary); }

.hero { padding: 72px 0 54px; background: radial-gradient(circle at 85% 20%, #dce7ff 0, transparent 34%), linear-gradient(180deg, #fff 0%, #f7f9fd 100%); }
.hero-grid { display: grid; grid-template-columns: 1.25fr 0.75fr; gap: 56px; align-items: center; }
.eyebrow { margin: 0 0 12px; color: var(--primary); font-size: 12px; font-weight: 800; letter-spacing: 0.16em; }
.hero h1 { margin: 0; font-size: clamp(38px, 5vw, 64px); line-height: 1.12; letter-spacing: -0.04em; }
.hero h1 span { color: var(--primary); }
.hero-desc { max-width: 620px; margin: 24px 0 28px; color: var(--muted); font-size: 17px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 700; font-size: 14px; transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--primary); box-shadow: 0 10px 24px rgba(36, 87, 214, 0.22); }
.button.primary:hover { background: var(--primary-dark); }
.button.ghost { color: var(--text); background: var(--surface); border-color: var(--line); }
.button.ghost:hover { border-color: #b9c6da; }
.button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.hero-panel { padding: 30px; border: 1px solid rgba(255,255,255,0.8); border-radius: 26px; background: rgba(255,255,255,0.78); box-shadow: var(--shadow); }
.stat-main { display: flex; flex-direction: column; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.stat-main span { color: var(--primary); font-size: 58px; font-weight: 900; line-height: 1; letter-spacing: -0.05em; }
.stat-main small { margin-top: 8px; color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 22px 0; }
.stat-grid div { display: flex; flex-direction: column; }
.stat-grid strong { font-size: 20px; }
.stat-grid span { color: var(--muted); font-size: 12px; }
.stat-note { margin: 0; color: var(--muted); font-size: 12px; }

.section { padding: 64px 0 80px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.section-heading h2 { margin: 0; font-size: 32px; letter-spacing: -0.03em; }
.muted { color: var(--muted); font-size: 13px; }
.toolbar { display: flex; gap: 14px; margin-bottom: 18px; }
.search-box { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.search-box span { color: var(--muted); font-size: 24px; line-height: 1; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); }
.sort-box { display: flex; align-items: center; gap: 10px; padding: 0 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; color: var(--muted); font-size: 13px; }
.sort-box select { border: 0; outline: 0; background: transparent; color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.chip { padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 13px; }
.chip:hover { border-color: #b9c6da; color: var(--text); }
.chip.active { color: #fff; background: var(--primary); border-color: var(--primary); }
.chip small { margin-left: 5px; opacity: 0.72; }

.resource-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.resource-card { display: flex; flex-direction: column; min-height: 230px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease; }
.resource-card:hover { transform: translateY(-3px); border-color: #c5d2e6; box-shadow: var(--shadow); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.category-badge { padding: 4px 9px; border-radius: 999px; color: var(--primary); background: #eaf0ff; font-size: 11px; font-weight: 700; }
.status-badge { font-size: 11px; color: var(--success); }
.status-badge.missing { color: var(--danger); }
.resource-card h3 { margin: 0 0 8px; font-size: 18px; line-height: 1.4; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 12px; }
.card-desc { display: -webkit-box; margin: 14px 0 18px; overflow: hidden; color: var(--muted); font-size: 13px; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.file-size { color: var(--muted); font-size: 12px; }
.card-link { color: var(--primary); font-size: 13px; font-weight: 800; }

.empty-state { padding: 70px 20px; text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty-state strong { font-size: 20px; }
.empty-state p { margin: 8px 0 20px; color: var(--muted); }
.pagination { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 32px; color: var(--muted); font-size: 13px; }

.detail-page, .download-page { min-height: calc(100vh - 220px); padding-top: 36px; padding-bottom: 72px; }
.back-link { display: inline-block; margin-bottom: 20px; color: var(--muted); font-size: 13px; }
.back-link:hover { color: var(--primary); }
.detail-card, .download-card { padding: clamp(24px, 5vw, 48px); background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 26px; border-bottom: 1px solid var(--line); }
.detail-head h1 { margin: 8px 0 10px; font-size: clamp(28px, 4vw, 42px); line-height: 1.25; letter-spacing: -0.03em; }
.detail-sub { color: var(--muted); }
.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; padding: 28px 0; }
.detail-stat { padding: 16px; border-radius: 14px; background: var(--surface-2); }
.detail-stat span { display: block; color: var(--muted); font-size: 11px; }
.detail-stat strong { display: block; margin-top: 4px; font-size: 14px; word-break: break-all; }
.detail-section { padding: 18px 0; }
.detail-section h2 { margin: 0 0 10px; font-size: 18px; }
.detail-section p { margin: 0; color: var(--muted); white-space: pre-wrap; }
.hash { padding: 12px 14px; border-radius: 10px; background: #0f172a; color: #cbd5e1; font: 12px/1.6 Consolas, monospace; word-break: break-all; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }

.download-card { max-width: 760px; margin: 30px auto 0; text-align: center; }
.download-icon { width: 72px; height: 72px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 22px; color: #fff; background: linear-gradient(135deg, var(--primary), #6b8cff); font-size: 30px; }
.download-card h1 { margin: 0 0 10px; font-size: 28px; }
.download-card .file-name { color: var(--muted); word-break: break-all; }
.download-info { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px 24px; margin: 24px 0; color: var(--muted); font-size: 13px; }
.download-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
.download-status { margin-top: 18px; color: var(--muted); font-size: 13px; min-height: 24px; }
.notice { margin-top: 24px; padding: 14px 16px; border-radius: 12px; background: #fff7e6; color: #805b12; font-size: 13px; text-align: left; }

.site-footer { padding: 28px 0; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 12px; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; }
.footer-inner p { margin: 0; }
.footer-inner a:hover { color: var(--primary); }

.conflict-list { display: grid; gap: 28px; }
.conflict-group { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.conflict-group h3 { margin: 0 0 16px; }
.conflict-group .resource-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.section.compact { padding-top: 34px; }
.featured-panel { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 24px; margin-top: 26px; padding: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.featured-panel h3 { margin: 0 0 6px; font-size: 22px; }
.download-links { display: flex; flex-wrap: wrap; align-content: start; gap: 10px; }
.download-links a { padding: 9px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--primary); font-size: 13px; font-weight: 700; }
.download-links a:hover { border-color: #b9c6da; background: #eaf0ff; }
.archive-links { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 16px; color: var(--muted); font-size: 12px; }
.archive-links a { color: var(--primary); }

/* Original-daymoe home style */
body.old-home {
  margin: 0;
  color: #333;
  background-color: #f8f9fa;
  background-image: url("../img/background.png");
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-position: 100% 100%;
  background-size: 300px auto;
  font-family: "Microsoft YaHei", "SimSun", Arial, sans-serif;
  line-height: 1.75;
}
body.old-home::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(248, 249, 250, 0.9);
  pointer-events: none;
}
.old-page { width: min(920px, calc(100% - 28px)); margin: 0 auto; padding: 18px 0 60px; }
.old-header { text-align: center; }
.old-title { font-size: 19px; font-weight: 400; color: #222; }
.old-red-title { color: #d40000; font-size: 14px; margin-left: 4px; }
.old-meta { margin-top: 3px; color: #333; font-size: 13px; }
.old-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 3px 4px;
  margin: 18px 0 26px;
  padding: 8px 10px;
  background: #fff;
  border-top: 1px solid #e5e5e5;
  border-bottom: 1px solid #e5e5e5;
  font-size: 14px;
}
.old-nav .nav-item > a {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 4px;
  color: #222;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.old-nav .nav-item > a:hover { color: #0077b6; background: #f3f8fd; text-decoration: none; }
.old-nav .nav-item > a.active { color: #d40000; background: #fff1f1; font-weight: 700; text-decoration: none; }
.old-main { font-size: 14px; }
.old-main p { margin: 10px 0; }
.old-main a { color: #0077b6; text-decoration: none; }
.old-main a:hover { text-decoration: underline; }
.old-intro { font-size: 15px; }
.old-big-link { font-size: 16px; }
.old-note { color: #444; }
.old-red { color: #d40000; }
.old-date { color: #d40000; }
.old-news { margin: 16px 0; }
.old-news > div { margin: 3px 0; }
.old-packages { margin: 16px 0 6px; color: #444; }
.old-packages > div { margin: 4px 0; }
.old-hr { margin: 26px 0 18px; border: 0; border-top: 1px solid #ddd; }
.old-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 14px 0 12px;
  font-size: 18px;
  font-weight: 700;
}
.old-muted { color: #777; font-size: 12px; font-weight: 400; }
.old-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-bottom: 10px;
  padding: 9px 12px;
  background: #fff;
  border: 1px solid #e3e3e3;
  font-size: 13px;
}
.old-toolbar input[type="search"] {
  width: 190px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid #bbb;
  border-radius: 2px;
  background: #fff;
}
.old-toolbar select { height: 30px; }
.old-stats { margin-left: auto; color: #666; font-size: 12px; }
.old-stats b { color: #333; }
.old-rom-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255,255,255,0.9);
  font-size: 13px;
}
.old-rom-table th, .old-rom-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #e7e7e7;
  text-align: left;
  vertical-align: top;
}
.old-rom-table th { background: #eceff2; font-weight: 700; }
.old-rom-table tbody tr:hover { background: #f2f7ff; }
.old-rom-table td:nth-child(1) { width: 92px; color: #d40000; white-space: nowrap; }
.old-rom-table td:nth-child(3) { width: 72px; white-space: nowrap; color: #666; font-variant-numeric: tabular-nums; }
.old-rom-table td:nth-child(4) { width: 85px; white-space: nowrap; color: #666; }
.old-rom-table td:nth-child(5) { width: 112px; white-space: nowrap; }
.old-empty { padding: 24px; text-align: center; color: #777; background: #fff; border: 1px solid #e3e3e3; }
.old-link-button {
  padding: 0;
  border: 0;
  background: none;
  color: #0077b6;
  cursor: pointer;
  text-decoration: underline;
}
.old-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin: 16px 0;
  color: #666;
  font-size: 13px;
}
.old-pagination button {
  padding: 5px 12px;
  border: 1px solid #c6d0dc;
  border-radius: 4px;
  background: #fff;
  color: #333;
  cursor: pointer;
}
.old-pagination button:disabled { color: #aaa; cursor: default; }
.old-footer { margin-top: 30px; padding-top: 14px; border-top: 1px solid #e3e3e3; text-align: center; color: #666; font-size: 12px; }
.old-footer a { color: #0077b6; }
@media (max-width: 700px) {
  .old-title { font-size: 15px; }
  .old-red-title { display: block; margin: 2px 0 0; font-size: 12px; }
  .old-nav { gap: 6px 14px; font-size: 12px; }
  .old-stats { width: 100%; margin-left: 0; }

  .old-rom-table { display: block; background: transparent; }
  .old-rom-table thead { display: none; }
  .old-rom-table tbody { display: block; }
  .old-rom-table tr {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "name name name"
      "date change size"
      "action action action";
    gap: 2px 12px;
    padding: 9px 10px;
    border-bottom: 1px solid #e7e7e7;
    background: rgba(255,255,255,0.9);
  }
  .old-rom-table td { display: block; width: auto !important; padding: 0; border: 0; }
  .old-rom-table td:nth-child(1) { grid-area: date; width: auto; font-size: 12px; white-space: nowrap; }
  .old-rom-table td:nth-child(2) { grid-area: name; line-height: 1.55; overflow-wrap: anywhere; }
  .old-rom-table td:nth-child(3) { grid-area: change; width: auto; font-size: 12px; white-space: nowrap; }
  .old-rom-table td:nth-child(3)::before { content: "修改率 "; color: #999; }
  .old-rom-table td:nth-child(4) { grid-area: size; width: auto; text-align: right; font-size: 12px; white-space: nowrap; }
  .old-rom-table td:nth-child(5) { grid-area: action; width: auto; margin-top: 3px; display: flex; align-items: center; }
  .old-rom-table td:nth-child(5) .old-download-button { padding: 5px 0; }
  .old-rom-table tbody tr:hover { background: #f2f7ff; }
}
@media (max-width: 380px) {
  .old-section-head { flex-wrap: wrap; }
  .old-section-head > span:first-child { white-space: nowrap; }
  .old-section-head #resultSummary { width: 100%; margin-top: 2px; }
}

/* Shared original-style pages */
body.old-theme {
  color: #333;
  background-color: #f8f9fa;
  background-image: url("../img/background.png");
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-position: 100% 100%;
  background-size: 260px auto;
  font-family: "Microsoft YaHei", "SimSun", Arial, sans-serif;
  line-height: 1.75;
}
body.old-theme::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(248, 249, 250, 0.92);
  pointer-events: none;
}
body.old-theme .container { width: 100%; margin: 0; }
body.old-theme .old-page { width: min(920px, calc(100% - 28px)); margin: 0 auto; padding: 18px 0 60px; }
body.old-theme .old-main { font-size: 14px; }
body.old-theme .site-header {
  position: static;
  background: transparent;
  border: 0;
  backdrop-filter: none;
}
body.old-theme .header-inner {
  min-height: 0;
  padding: 16px 0 0;
  flex-direction: column;
  gap: 5px;
}
body.old-theme .brand { display: block; text-align: center; }
body.old-theme .brand-mark { display: none; }
body.old-theme .brand-text { display: block; }
body.old-theme .brand-text strong { font-size: 19px; font-weight: 400; color: #222; }
body.old-theme .brand-text small { display: inline; color: #d40000; font-size: 13px; margin-left: 4px; }
body.old-theme .top-nav {
  width: 100%;
  justify-content: center;
  gap: 8px 26px;
  margin: 12px 0 22px;
  padding: 12px 8px;
  background: #fff;
  border-top: 1px solid #e5e5e5;
  border-bottom: 1px solid #e5e5e5;
  font-size: 14px;
}
body.old-theme .top-nav a { color: #222; border: 0; padding: 0; }
body.old-theme .top-nav a:hover, body.old-theme .top-nav a.active { color: #0077b6; text-decoration: underline; }
body.old-theme .detail-page, body.old-theme .download-page { min-height: 0; padding-top: 0; padding-bottom: 40px; }
body.old-theme .back-link { color: #0077b6; font-size: 13px; }
body.old-theme .eyebrow { color: #d40000; font-size: 12px; letter-spacing: 0; }
body.old-theme h1 { margin: 6px 0 10px; font-size: 22px; font-weight: 700; letter-spacing: 0; }
body.old-theme h2 { font-size: 18px; }
body.old-theme .hero-desc { max-width: none; margin: 8px 0 16px; color: #555; font-size: 14px; }
body.old-theme .detail-card, body.old-theme .download-card {
  padding: 18px 20px;
  border: 1px solid #e3e3e3;
  border-radius: 0;
  background: rgba(255,255,255,0.92);
  box-shadow: none;
}
body.old-theme .detail-head { padding-bottom: 14px; border-bottom: 1px solid #e7e7e7; }
body.old-theme .detail-head h1 { font-size: 21px; }
body.old-theme .detail-sub { font-size: 12px; color: #777; }
body.old-theme .category-badge { padding: 0; border-radius: 0; background: none; color: #0077b6; font-size: 12px; }
body.old-theme .status-badge { color: #16825d; font-size: 12px; }
body.old-theme .detail-grid { gap: 8px; padding: 14px 0; grid-template-columns: repeat(4, 1fr); }
body.old-theme .detail-stat { padding: 8px 10px; border: 1px solid #e7e7e7; border-radius: 0; background: #fafafa; }
body.old-theme .detail-stat span { font-size: 11px; }
body.old-theme .detail-stat strong { font-size: 12px; }
body.old-theme .detail-section { padding: 10px 0; }
body.old-theme .detail-section h2 { margin-bottom: 6px; font-size: 15px; }
body.old-theme .detail-section p { font-size: 13px; color: #555; }
body.old-theme .hash { padding: 8px 10px; border: 1px solid #ddd; border-radius: 0; background: #f4f4f4; color: #333; font-size: 11px; }
body.old-theme .button { min-height: 30px; padding: 4px 12px; border-radius: 2px; font-size: 13px; font-weight: 400; box-shadow: none; }
body.old-theme .button.primary { background: #0077b6; }
body.old-theme .button.ghost { background: #fff; border-color: #bbb; color: #333; }
body.old-theme .resource-grid { grid-template-columns: 1fr; gap: 0; border-top: 1px solid #e3e3e3; }
body.old-theme .resource-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 12px;
  min-height: 0;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid #e7e7e7;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
body.old-theme .resource-card:hover { transform: none; border-color: #e7e7e7; box-shadow: none; background: #f2f7ff; }
body.old-theme .resource-card .card-top { display: none; }
body.old-theme .resource-card h3 { grid-column: 1; margin: 0; font-size: 15px; }
body.old-theme .resource-card .card-desc { grid-column: 1; margin: 1px 0 0; font-size: 12px; color: #777; -webkit-line-clamp: 1; }
body.old-theme .resource-card .card-meta { display: none; }
body.old-theme .resource-card .card-footer { grid-column: 2; grid-row: 1 / span 2; align-self: center; padding: 0; border: 0; }
body.old-theme .resource-card .file-size { display: none; }
body.old-theme .resource-card .card-link { font-size: 12px; white-space: nowrap; }
body.old-theme .old-content { font-size: 14px; }
body.old-theme .old-content a { color: #0077b6; text-decoration: none; }
body.old-theme .old-content a:hover { text-decoration: underline; }
body.old-theme .old-content pre { white-space: pre-wrap; word-wrap: break-word; font-size: 13px; }
body.old-theme .old-content img { max-width: 100%; height: auto; }
body.old-theme .old-content h1 { font-size: 21px; }
body.old-theme .old-content h2 { font-size: 17px; }
body.old-theme .old-content h3 { font-size: 15px; }
body.old-theme .legacy-frame { width: 100%; height: 72vh; min-height: 480px; border: 1px solid #ccc; background: #fff; }
body.old-theme .download-icon { display: none; }
body.old-theme .download-card { max-width: none; margin: 0; text-align: left; }
body.old-theme .download-card h1 { text-align: left; }
body.old-theme .download-info, body.old-theme .download-actions { justify-content: flex-start; }
body.old-theme .download-status { text-align: left; font-size: 12px; }
body.old-theme .notice { margin-top: 14px; padding: 9px 11px; border: 1px solid #ead9a8; border-radius: 0; background: #fff9e8; color: #6b5419; font-size: 12px; }
body.old-theme .section-heading { margin-bottom: 14px; }
body.old-theme .section-heading h2 { font-size: 19px; }
body.old-theme .muted { font-size: 12px; }
body.old-theme .empty-state { padding: 24px; border-radius: 0; background: #fff; }
body.old-theme .conflict-group { border-radius: 0; background: #fff; }
body.old-theme .site-footer { margin-top: 20px; padding: 14px 0; background: transparent; border-top: 1px solid #e3e3e3; text-align: center; font-size: 12px; }
body.old-theme .footer-inner { display: block; }
body.old-theme .footer-inner p + p { margin-top: 5px; }
@media (max-width: 700px) {
  body.old-theme .brand-text strong { font-size: 15px; }
  body.old-theme .brand-text small { display: block; font-size: 12px; }
  body.old-theme .top-nav { gap: 6px 14px; font-size: 12px; }
  body.old-theme .resource-grid { grid-template-columns: 1fr; }
  body.old-theme .detail-grid { grid-template-columns: 1fr 1fr; }
  body.old-theme .detail-head h1 { font-size: 18px; }
}

.loading { padding: 60px 20px; text-align: center; color: var(--muted); }
.error-box { padding: 24px; border: 1px solid #f1c5ca; border-radius: 14px; background: #fff5f6; color: var(--danger); }

@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 34px; }
  .hero-panel { max-width: 620px; }
  .resource-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 680px) {
  .container { width: min(100% - 24px, 1180px); }
  .header-inner { min-height: 66px; }
  .brand-text small { display: none; }
  .top-nav { gap: 14px; font-size: 12px; }
  .top-nav a:nth-child(n+3) { display: none; }
  .hero { padding: 44px 0 34px; }
  .hero h1 { font-size: 38px; }
  .hero-desc { font-size: 15px; }
  .section { padding: 42px 0 56px; }
  .featured-panel { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .toolbar { flex-direction: column; }
  .sort-box { min-height: 46px; }
  .resource-grid { grid-template-columns: 1fr; }
  .detail-head { flex-direction: column; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .footer-inner { flex-direction: column; gap: 6px; }
}

.old-download-button,
.old-download-button:hover,
.old-download-button:active,
.old-download-button:focus {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  transform: none;
  color: #0077b6;
  font: inherit;
  line-height: inherit;
  cursor: pointer;
  outline: none;
}
.old-download-button:hover { text-decoration: underline; }
.old-action-sep { color: #aaa; margin: 0 4px; }
.old-download-button:focus-visible { outline: 1px dotted currentColor; outline-offset: 2px; }
.old-download-button:disabled { color: #999; cursor: default; text-decoration: none; }

/* Documentation library */
body.docs-library .old-page { width: min(1240px, calc(100% - 28px)); }
.docs-page .doc-browser {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 12px;
  margin-top: 14px;
}
.docs-page .doc-sidebar {
  max-height: 76vh;
  overflow-y: auto;
  padding: 8px;
  background: #fff;
  border: 1px solid #e3e3e3;
}
.docs-page .doc-item {
  display: block;
  width: 100%;
  padding: 4px 6px;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: #333;
  font: inherit;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
  transform: none;
  outline: none;
  word-break: break-all;
}
.docs-page .doc-item:hover { color: #0077b6; text-decoration: underline; }
.docs-page .doc-item:focus-visible { outline: 1px dotted currentColor; outline-offset: 1px; }
.docs-page .doc-item.active { color: #d40000; font-weight: 700; text-decoration: none; }
.docs-page .doc-viewer iframe {
  display: block;
  width: 100%;
  height: 76vh;
  min-height: 480px;
  border: 1px solid #e3e3e3;
  background: #fff;
}
@media (max-width: 768px) {
  .docs-page .doc-browser { grid-template-columns: 1fr; }
  .docs-page .doc-sidebar { max-height: 220px; }
  .docs-page .doc-viewer iframe { height: 60vh; min-height: 360px; }
}

/* Embedded documents loaded inside the library viewer */
html.embedded body { background: #fff !important; }
html.embedded body::before { display: none; }
html.embedded .back-link, html.embedded .eyebrow { display: none; }

/* Nav dropdowns */
.old-nav .nav-item { position: relative; display: inline-flex; align-items: center; }
.old-nav .nav-sub {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  min-width: 180px;
  padding: 6px 0;
  background: #fff;
  border: 1px solid #e5e5e5;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  z-index: 80;
  text-align: left;
}
.old-nav .nav-item:hover .nav-sub,
.old-nav .nav-item:focus-within .nav-sub { display: block; }
.old-nav .nav-sub a {
  display: block;
  padding: 5px 14px;
  color: #222;
  font-size: 13px;
  line-height: 1.6;
  white-space: nowrap;
  text-decoration: none;
}
.old-nav .nav-sub a:hover { color: #0077b6; background: #f4f8fd; }
@media (max-width: 768px) {
  .old-nav .nav-sub { left: 0; transform: none; }
}

/* Hack CT2 PC page */
.hack-downloads { margin: 10px 0; padding-left: 20px; }
.hack-downloads li { margin: 6px 0; }
.hack-log {
  max-height: 360px;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid #e3e3e3;
  background: #f7f9fb;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.hack-shots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.hack-shots img { width: 100%; height: auto; border: 1px solid #e3e3e3; }

/* Legacy hover GIF */
.old-warning { color: #d40000; position: relative; margin: 10px 0; line-height: 1.75; }
.old-warning { cursor: help; }
.hover-gif-preview {
  display: none;
  position: fixed;
  max-width: 120px;
  height: auto;
  border: 1px solid #ccc;
  background: #fff;
  z-index: 60;
}

/* Header meta links and NSF BGM */
.old-meta a { color: #0077b6; text-decoration: none; }
.old-meta a:hover { text-decoration: underline; }
.bgm-toggle,
.bgm-toggle:hover,
.bgm-toggle:active,
.bgm-toggle:focus {
  padding: 0 3px;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  transform: none;
  color: #0077b6;
  font: inherit;
  line-height: 1;
  cursor: pointer;
  outline: none;
}
.bgm-toggle:hover { text-decoration: underline; }
.bgm-toggle:focus-visible { outline: 1px dotted currentColor; outline-offset: 1px; }
.bgm-toggle:disabled { color: #999; cursor: default; text-decoration: none; }

/* Theme picker */
.theme-picker { display: inline-flex; align-items: center; gap: 3px; color: #333; font-size: 13px; white-space: nowrap; }
.theme-picker select {
  height: 24px;
  font-size: 12px;
}
.theme-picker select:focus-visible { outline: 1px dotted currentColor; outline-offset: 2px; }

/* Dark theme */
html[data-theme="dark"] {
  color-scheme: dark;
  background-color: #0f1318;
  --bg: #0f1318;
  --surface: #1a2027;
  --surface-2: #151b22;
  --text: #d8dee8;
  --muted: #93a0b0;
  --line: #303944;
  --primary: #6cb6ff;
  --primary-dark: #4f9be8;
  --accent: #e5c97a;
  --success: #4cc38a;
  --danger: #ff7b7b;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
html[data-theme="dark"] body { background: #0f1318; color: #d8dee8; }
html[data-theme="dark"] body.old-home,
html[data-theme="dark"] body.old-theme { background-color: #0f1318; color: #d8dee8; }
html[data-theme="dark"] body.old-home::before,
html[data-theme="dark"] body.old-theme::before { background: rgba(15, 19, 24, 0.94); }
html[data-theme="dark"] .old-page { color: #d8dee8; }
html[data-theme="dark"] .old-title { color: #e6edf5; }
html[data-theme="dark"] .old-red-title { color: #ff7b7b; }
html[data-theme="dark"] .old-meta { color: #c4cedb; }
html[data-theme="dark"] .old-meta a,
html[data-theme="dark"] .bgm-toggle { color: #6cb6ff; }
html[data-theme="dark"] .bgm-toggle:disabled { color: #5f6b7a; }
html[data-theme="dark"] .theme-picker { color: #c4cedb; }

html[data-theme="dark"] .old-nav { background: #171c22; border-color: #2c343d; }
html[data-theme="dark"] .old-nav a { color: #d8dee8; }
html[data-theme="dark"] .old-nav a:hover { color: #6cb6ff; }
html[data-theme="dark"] .old-nav a.active { color: #ff7b7b; }
html[data-theme="dark"] .old-nav .nav-item > a:hover { background: #232b34; }
html[data-theme="dark"] .old-nav .nav-item > a.active { background: #3a1f24; }
html[data-theme="dark"] .old-nav .nav-sub { background: #1b2128; border-color: #333c46; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4); }
html[data-theme="dark"] .old-nav .nav-sub a { color: #d8dee8; }
html[data-theme="dark"] .old-nav .nav-sub a:hover { background: #232b34; color: #6cb6ff; }

html[data-theme="dark"] .old-main,
html[data-theme="dark"] .old-content { color: #d8dee8; }
html[data-theme="dark"] .old-main a,
html[data-theme="dark"] .old-content a,
html[data-theme="dark"] .back-link { color: #6cb6ff; }
html[data-theme="dark"] .old-intro { color: #e6edf5; }
html[data-theme="dark"] .old-note,
html[data-theme="dark"] .old-packages { color: #b8c2cf; }
html[data-theme="dark"] .old-red,
html[data-theme="dark"] .old-date,
html[data-theme="dark"] .old-warning { color: #ff7b7b; }
html[data-theme="dark"] .old-muted,
html[data-theme="dark"] .old-stats { color: #93a0b0; }
html[data-theme="dark"] .old-stats b { color: #e6edf5; }
html[data-theme="dark"] .eyebrow { color: #ff7b7b; }
html[data-theme="dark"] .hero-desc { color: #aab5c4; }
html[data-theme="dark"] .old-section-head { color: #e6edf5; }
html[data-theme="dark"] .old-content table,
html[data-theme="dark"] .old-content th,
html[data-theme="dark"] .old-content td { border-color: #303944; }
html[data-theme="dark"] .old-content th { background: #232b33; color: #e6edf5; }
html[data-theme="dark"] .old-content pre,
html[data-theme="dark"] .old-content code { background: #12171d; color: #d8dee8; }
html[data-theme="dark"] .hover-gif-preview { background: #1a2027; border-color: #3a4552; }

html[data-theme="dark"] .old-toolbar { background: #1a2027; border-color: #303944; color: #c4cedb; }
html[data-theme="dark"] .old-toolbar input[type="search"] { background: #12171d; border-color: #3a4552; color: #e6edf5; }
html[data-theme="dark"] .old-rom-table { background: #1a2027; }
html[data-theme="dark"] .old-rom-table th { background: #232b33; color: #e6edf5; }
html[data-theme="dark"] .old-rom-table td { border-bottom-color: #2b333d; color: #d8dee8; }
html[data-theme="dark"] .old-rom-table td:nth-child(1) { color: #ff7b7b; }
html[data-theme="dark"] .old-rom-table td:nth-child(3),
html[data-theme="dark"] .old-rom-table td:nth-child(4) { color: #93a0b0; }
html[data-theme="dark"] .old-rom-table tr { background: #1a2027; border-bottom-color: #2b333d; }
html[data-theme="dark"] .old-rom-table tbody tr:hover { background: #232b33; }
html[data-theme="dark"] .old-rom-table td:nth-child(3)::before { color: #93a0b0; }
html[data-theme="dark"] .old-download-button,
html[data-theme="dark"] .old-link-button { color: #6cb6ff; }
html[data-theme="dark"] .old-action-sep { color: #5f6b7a; }
html[data-theme="dark"] .old-empty { background: #1a2027; border-color: #303944; color: #c4cedb; }
html[data-theme="dark"] .old-pagination { color: #93a0b0; }
html[data-theme="dark"] .old-pagination button { background: #1a2027; border-color: #3a4552; color: #d8dee8; }
html[data-theme="dark"] .old-pagination button:disabled { color: #5f6b7a; }

html[data-theme="dark"] .detail-card,
html[data-theme="dark"] .download-card { background: #1a2027; border-color: #303944; color: #d8dee8; box-shadow: none; }
html[data-theme="dark"] .detail-head { border-bottom-color: #2b333d; }
html[data-theme="dark"] .detail-sub,
html[data-theme="dark"] .download-status,
html[data-theme="dark"] .download-info,
html[data-theme="dark"] .file-name { color: #93a0b0; }
html[data-theme="dark"] .category-badge { color: #8ab4ff; background: #1b2a44; }
html[data-theme="dark"] .status-badge { color: #4cc38a; }
html[data-theme="dark"] .detail-stat { background: #151b22; border-color: #303944; }
html[data-theme="dark"] .detail-stat span { color: #93a0b0; }
html[data-theme="dark"] .detail-stat strong { color: #e6edf5; }
html[data-theme="dark"] .detail-section p { color: #93a0b0; }
html[data-theme="dark"] .hash { background: #0b0f14; color: #cbd5e1; border-color: #303944; }
html[data-theme="dark"] .notice { background: #2a2315; border-color: #5a4a24; color: #e5c97a; }
html[data-theme="dark"] .empty-state { background: #1a2027; border-color: #303944; }
html[data-theme="dark"] .conflict-group { background: #151b22; border-color: #303944; }
html[data-theme="dark"] .button.primary { background: #2f6fd8; color: #fff; }
html[data-theme="dark"] .button.ghost { background: #1a2027; border-color: #3a4552; color: #d8dee8; }
html[data-theme="dark"] .button.ghost:hover { border-color: #6cb6ff; }

html[data-theme="dark"] .docs-page .doc-sidebar { background: #1a2027; border-color: #303944; }
html[data-theme="dark"] .docs-page .doc-item { color: #c4cedb; }
html[data-theme="dark"] .docs-page .doc-item:hover { color: #6cb6ff; }
html[data-theme="dark"] .docs-page .doc-item.active { color: #ff7b7b; }
html[data-theme="dark"] .docs-page .doc-viewer iframe { border-color: #303944; background: #12171d; }
html[data-theme="dark"] .legacy-frame { border-color: #303944; background: #fff; }
html[data-theme="dark"] .hack-log { background: #12171d; border-color: #303944; color: #d8dee8; }
html[data-theme="dark"] .hack-shots img { border-color: #303944; }
html[data-theme="dark"] .error-box { background: #2a171b; border-color: #5a2a32; color: #ff9aa5; }
html[data-theme="dark"] .old-footer,
html[data-theme="dark"] .site-footer { color: #93a0b0; border-color: #303944; background: transparent; }
html[data-theme="dark"] .old-footer a,
html[data-theme="dark"] .site-footer a { color: #6cb6ff; }
html[data-theme="dark"] .old-packages a { color: #8ec9ff; }
html[data-theme="dark"] body.old-theme input,
html[data-theme="dark"] body.old-theme textarea,
html[data-theme="dark"] body.old-theme select { background-color: #12171d; color: #e6edf5; border-color: #3a4552; }
html[data-theme="dark"] .old-content div[style*="background-color:white"],
html[data-theme="dark"] .old-content div[style*="background-color: white"] {
  background: #12171d !important;
  color: #d8dee8 !important;
  border-color: #3a4552 !important;
}
html[data-theme="dark"] .old-content textarea { background: #12171d; color: #d8dee8; border-color: #3a4552; }
html[data-theme="dark"] .old-content font[color],
html[data-theme="dark"] .old-content [style*="color:red"] { color: #ff7b7b !important; }

@media (max-width: 700px) {
  .old-content textarea[style*="width:700px"],
  .old-content div[style*="width:700px"] { width: 100% !important; max-width: 100%; }
}

/* Unified selects and page jump */
select.site-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 4px 25px 4px 8px;
  border: 1px solid #c6d0dc;
  border-radius: 4px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23555' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 9px 6px;
  color: #333;
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
  vertical-align: middle;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
select.site-select:hover { border-color: #9fb0c8; }
select.site-select:focus-visible { outline: 1px dotted currentColor; outline-offset: 2px; }
select.site-select:disabled { opacity: 0.55; cursor: default; }
.theme-picker select.site-select { height: 24px; padding: 2px 22px 2px 6px; font-size: 12px; }
.old-toolbar select.site-select { height: 30px; padding: 0 26px 0 8px; }
select.site-select.old-page-select {
  height: 28px;
  min-width: 52px;
  padding: 2px 24px 2px 8px;
  text-align: center;
}
.old-page-jump { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
html[data-theme="dark"] select.site-select {
  background-color: #12171d;
  border-color: #3a4552;
  color: #e6edf5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23d8dee8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
html[data-theme="dark"] select.site-select:hover { border-color: #5b6b7f; }
@media (max-width: 700px) {
  .old-nav { gap: 2px; padding: 6px; }
  .old-nav .nav-item > a { padding: 4px 7px; }
  .old-page-jump { gap: 2px; }
  select.site-select.old-page-select { min-width: 46px; padding: 2px 20px 2px 6px; font-size: 12px; }
}


/* Password generator page */
.password-page #maindiv { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.password-page .password-details { margin: 14px 0; border: 1px solid var(--line); background: var(--surface); }
.password-page .password-details summary { padding: 8px 10px; cursor: pointer; font-weight: 700; color: var(--text); }
.password-page .password-details summary:hover { color: var(--primary); }
.password-page .password-details[open] summary { border-bottom: 1px solid var(--line); }
.password-page .password-details .details-body { padding: 10px; overflow-x: auto; }
.password-page .short-password-list { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0; }
.password-page .short-password-list .old-link-button { font-size: 13px; }
.password-page table.gridtable { color: var(--text); border: 1px solid var(--line); border-collapse: collapse; }
.password-page table.gridtable th { border: 1px solid var(--line); background: var(--surface-2); color: var(--text); }
.password-page table.gridtable td { border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 3px 6px; }
.password-page .pgbw { border: 0; background-color: #000; color: #fff; }
.password-page form input[type="text"]:not(.pgbw),
.password-page form textarea { padding: 2px 4px; border: 1px solid var(--line); border-radius: 2px; background: var(--surface); color: var(--text); font: inherit; }
.password-page form select.site-select { height: 26px; padding: 1px 20px 1px 6px; font-size: 12px; }
.password-page .password-tools { margin: 0 0 14px; }
.password-page .pw-generate-title { margin: 0 0 6px; }
.password-page .pw-hint { margin: 4px 0 8px; }
.password-page .pw-hint-inline { margin-left: 6px; }
.password-page .password-tools textarea { width: 100%; box-sizing: border-box; min-height: 58px; resize: vertical; }
.password-page .pw-options { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 6px 0; color: var(--text); font-size: 13px; }
.password-page .pw-option { display: inline-flex; align-items: center; gap: 4px; }
.password-page .pw-cell-preview { margin: 8px 0 2px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.password-page .pw-cell-summary { color: var(--muted); font-size: 12px; line-height: 1.4; margin-bottom: 4px; }
.password-page .pw-cell-layout { display: flex; flex-direction: column; gap: 4px; width: max-content; max-width: 100%; }
.password-page .pw-cell-line { display: flex; gap: 12px; }
.password-page .pw-cell-group { display: grid; grid-template-columns: repeat(5, 28px); gap: 2px; }
.password-page .pw-cell-group.is-last { grid-template-columns: repeat(3, 28px); }
.password-page .pw-cell { display: flex; flex-direction: column; align-items: center; border: 1px solid var(--line); background: var(--surface); border-radius: 2px; padding: 1px 0; min-width: 24px; }
.password-page .pw-cell small { color: var(--muted); font-size: 9px; line-height: 1.1; }
.password-page .pw-cell b { color: var(--text); font-size: 14px; font-weight: 500; line-height: 1.25; }
.password-page .pw-cell.is-blank { background: var(--surface-2); }
.password-page .pw-cell.is-blank b { color: var(--primary); }
.password-page .pw-cell.is-pad { opacity: .5; }
.password-page .pw-actions { margin-top: 6px; }
.password-page #passwordDecodeResult { margin-top: 8px; font-size: 13px; line-height: 1.6; overflow-x: auto; }
.password-page .pw-status { margin-bottom: 4px; }
.password-page .pw-summary { color: var(--text); }
.password-page .pw-slots { margin-top: 6px; width: auto; min-width: 260px; }
.password-page .pw-slots td { padding: 2px 8px; }
.password-page .pw-note { margin-top: 4px; }
.password-page .pw-apply { margin-top: 8px; }
.password-page font[color="red"] { color: var(--danger); }
@media (max-width: 700px) {
  .password-page .pw-cell-line { gap: 8px; }
  .password-page .pw-cell-group { grid-template-columns: repeat(5, 24px); }
  .password-page .pw-cell-group.is-last { grid-template-columns: repeat(3, 24px); }
}
