:root {
  color-scheme: light;
  --ink: #111111;
  --paper: #fff7de;
  --white: #ffffff;
  --red: #ef2f2f;
  --blue: #0078d8;
  --cyan: #21c4e8;
  --yellow: #ffd51f;
  --green: #14a66f;
  --pink: #ff6fae;
  --muted: #5d5750;
  --line: #111111;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
  --font-sans: "Segoe UI", "Noto Sans", "Noto Sans CJK", "Source Han Sans", Arial, sans-serif;
  --font-phonetic: "Charis SIL", "Doulos SIL", "Gentium Plus", "Noto Sans", "Segoe UI", "Arial Unicode MS", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 1px 1px, rgba(17, 17, 17, 0.16) 1px, transparent 1.4px) 0 0 / 16px 16px,
    linear-gradient(132deg, #fff7dc 0 28%, #eef7ff 28% 66%, #fff0f6 66% 100%);
  font-family: var(--font-serif);
  line-height: 1.58;
  overflow-x: hidden;
}

body::before {
  display: none;
}

body::after {
  display: none;
}

.page-orb {
  position: absolute;
  right: clamp(18px, 4vw, 78px);
  top: clamp(96px, 10vw, 136px);
  z-index: 0;
  width: clamp(220px, 20vw, 320px);
  height: clamp(180px, 16vw, 248px);
  border: 4px solid var(--line);
  background:
    radial-gradient(circle at 6px 6px, rgba(17, 17, 17, 0.72) 2px, transparent 2.8px) 0 0 / 18px 18px,
    linear-gradient(146deg, var(--yellow) 0 49%, transparent 49%),
    linear-gradient(164deg, transparent 0 38%, var(--blue) 38% 68%, var(--green) 68% 100%);
  box-shadow: 7px 7px 0 var(--ink);
  clip-path: polygon(0 4%, 100% 0, 100% 76%, 72% 76%, 72% 96%, 0 100%);
  transform: rotate(-1.5deg);
  opacity: 0.72;
}

.page-orb:hover {
  transform: rotate(0deg) translate(-2px, -2px);
}

.page-orb::after {
  content: "";
  position: absolute;
  right: 12%;
  top: 10%;
  width: 34%;
  aspect-ratio: 1;
  background: var(--pink);
  border-radius: 50%;
}

.page-orb::before {
  content: "";
  position: absolute;
  left: 22%;
  top: 26%;
  z-index: 1;
  width: 42%;
  aspect-ratio: 1;
  background:
    radial-gradient(circle at 5px 5px, rgba(17, 17, 17, 0.78) 2px, transparent 2.8px) 0 0 / 17px 17px,
    var(--yellow);
  clip-path: polygon(50% 0, 62% 34%, 98% 34%, 68% 56%, 80% 96%, 50% 72%, 20% 96%, 32% 56%, 2% 34%, 38% 34%);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
  padding: 0 clamp(16px, 4vw, 56px);
  background: var(--yellow);
  border-bottom: 4px solid var(--line);
  box-shadow: 0 6px 0 var(--red);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: clamp(28px, 3vw, 44px);
  font-weight: 950;
  line-height: 1;
}

.brand-mark {
  display: block;
  width: 54px;
  height: 54px;
  object-fit: contain;
  background: var(--white);
  border: 4px solid var(--line);
  box-shadow: 5px 5px 0 var(--blue);
  transform: rotate(-4deg);
}

.top-nav {
  display: flex;
  align-items: stretch;
}

.top-nav button {
  min-height: 76px;
  padding: 0 20px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-left: 3px solid var(--line);
  border-radius: 0;
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 950;
}

.top-nav button:last-child {
  border-right: 3px solid var(--line);
}

.top-nav button:hover {
  color: var(--white);
  background: var(--blue);
}

main {
  position: relative;
}

.top-nav button:focus-visible,
.search-form input:focus,
.search-form button:focus-visible,
.filter-actions button:focus-visible,
.filter-tag:focus-visible,
.modal-close:focus-visible,
.doc-nav button:focus-visible,
.initial-grid button:focus-visible,
.feedback-tabs button:focus-visible,
.form-field input:focus,
.form-field textarea:focus,
.form-actions button:focus-visible {
  outline: 4px solid var(--blue);
  outline-offset: -4px;
}

.hero {
  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: clamp(390px, 34vw, 500px);
  margin: 0;
  padding: clamp(68px, 6vw, 88px) clamp(18px, 5vw, 72px) clamp(54px, 5vw, 70px);
  background:
    radial-gradient(circle at 1px 1px, rgba(17, 17, 17, 0.14) 1px, transparent 1.5px) 0 0 / 16px 16px,
    linear-gradient(112deg, transparent 0 15%, var(--red) 15% 34%, transparent 34%),
    linear-gradient(104deg, transparent 0 58%, var(--blue) 58% 75%, transparent 75%),
    linear-gradient(136deg, transparent 0 0, rgba(255, 213, 31, 0.22) 0 31%, transparent 31%),
    #fff6d8;
  border-bottom: 4px solid var(--line);
}

.hero::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 48%;
  z-index: 0;
  width: min(880px, 72vw);
  height: min(300px, 24vw);
  background: rgba(255, 255, 255, 0.72);
  border: 4px solid rgba(17, 17, 17, 0.12);
  transform: translate(-50%, -50%) skewX(-12deg);
}

.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 8px;
  background: var(--red);
  border-top: 4px solid var(--line);
}

.hero-copy {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  margin: 0 auto;
  padding: clamp(22px, 3vw, 34px) clamp(18px, 4vw, 42px) clamp(26px, 3.4vw, 38px);
  background: rgba(255, 250, 240, 0.82);
  border: 4px solid rgba(17, 17, 17, 0.14);
  box-shadow: 8px 8px 0 rgba(17, 17, 17, 0.12);
}

.hero-copy::before {
  content: "CQ-Pedia";
  position: absolute;
  top: -12px;
  left: 50%;
  z-index: 0;
  color: rgba(17, 17, 17, 0.07);
  font-family: var(--font-sans);
  font-size: clamp(68px, 11vw, 148px);
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
  transform: translateX(-50%);
}

.platform-label,
h1,
.search-form,
.filter-panel {
  position: relative;
  z-index: 1;
}

.platform-label {
  display: table;
  margin: 0 auto clamp(22px, 2.6vw, 30px);
  padding: 5px 12px 7px;
  color: var(--ink);
  background: var(--yellow);
  border: 4px solid var(--line);
  box-shadow: 6px 6px 0 var(--ink);
  font-family: var(--font-sans);
  font-size: clamp(14px, 1.3vw, 18px);
  font-weight: 950;
  line-height: 1.1;
  transform: rotate(-0.8deg);
}

h1 {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: clamp(54px, 8vw, 118px);
  font-weight: 950;
  line-height: 0.98;
  letter-spacing: 0;
  text-align: center;
  white-space: nowrap;
  text-shadow: 3px 3px 0 var(--white), 6px 6px 0 var(--red);
}

.search-form {
  position: relative;
  width: min(700px, calc(100% - 32px));
  margin: clamp(30px, 4vw, 46px) auto 0;
  padding: 11px;
  background: #fffaf0;
  border: 4px solid var(--line);
  box-shadow: 7px 7px 0 var(--yellow), 12px 12px 0 var(--ink);
}

.search-form::before {
  content: "FIND";
  position: absolute;
  top: -30px;
  right: 18px;
  padding: 2px 8px;
  color: var(--white);
  background: var(--red);
  border: 3px solid var(--line);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 950;
  transform: rotate(4deg);
}

.search-form input {
  width: 100%;
  min-height: 58px;
  padding: 0 124px 0 16px;
  color: var(--ink);
  background: var(--white);
  border: 3px solid var(--line);
  border-radius: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 700;
}

.search-form input::placeholder {
  color: rgba(17, 17, 17, 0.5);
}

.search-form .search-submit,
.search-form .filter-toggle {
  position: absolute;
  top: 50%;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  color: var(--white);
  background: var(--red);
  border: 3px solid var(--line);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  transform: translateY(-50%);
}

.search-form .search-submit {
  right: 72px;
  background: var(--red);
}

.search-form .filter-toggle {
  right: 18px;
  color: var(--ink);
  background: var(--yellow);
}

.search-form .search-submit svg,
.search-form .filter-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}

.search-form .filter-toggle svg {
  width: 20px;
  height: 20px;
  stroke-linejoin: round;
}

.search-form .search-submit:hover,
.search-form .filter-toggle:hover,
.search-form .filter-toggle.active {
  color: var(--white);
  background: var(--blue);
  transform: translate(2px, calc(-50% + 2px));
  box-shadow: 2px 2px 0 var(--ink);
}

.search-form .filter-toggle.active {
  background: var(--green);
}

.search-form .filter-toggle.has-filters:not(.active) {
  background: var(--cyan);
}

.filter-panel {
  display: grid;
  top: 8px;
  gap: 12px;
  width: min(680px, calc(100% - 28px));
  margin: 16px auto 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.filter-panel[hidden] {
  display: none;
}

.selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 42px;
  align-items: center;
  padding: 8px;
  background: var(--white);
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 rgba(17, 17, 17, 0.18);
}

.empty-tags {
  color: rgba(17, 17, 17, 0.5);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 900;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 4px 8px 4px 10px;
  color: var(--white);
  background: var(--blue);
  border: 3px solid var(--line);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 950;
}

.filter-tag span:last-child {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: var(--ink);
  background: var(--yellow);
  border: 2px solid var(--line);
  line-height: 1;
}

.filter-tag:hover {
  background: var(--red);
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.filter-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.filter-actions button {
  min-height: 42px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--yellow);
  border: 3px solid var(--line);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 950;
}

.filter-actions button:hover,
.filter-actions button.active {
  color: var(--white);
  background: var(--red);
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.results-panel {
  max-width: 1120px;
  margin: -28px auto 74px;
  padding: 0 clamp(18px, 5vw, 72px);
  animation: rise 320ms ease both;
}

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  color: var(--white);
  background: var(--blue);
  border: 4px solid var(--line);
  border-bottom: 0;
  box-shadow: 8px 8px 0 var(--ink);
  font-family: var(--font-sans);
  font-weight: 950;
  text-transform: uppercase;
}

.results-head p {
  margin: 0;
}

#resultCount {
  padding: 2px 10px;
  color: var(--ink);
  background: var(--yellow);
  border: 3px solid var(--line);
  white-space: nowrap;
}

.results {
  display: grid;
  counter-reset: entry-card;
  background: var(--white);
  border: 4px solid var(--line);
  box-shadow: 8px 8px 0 var(--yellow), 14px 14px 0 var(--ink);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px;
  background: var(--paper);
  border-bottom: 4px solid var(--line);
  font-family: var(--font-sans);
  font-weight: 950;
}

.pagination:last-child {
  border-top: 4px solid var(--line);
  border-bottom: 0;
}

.pagination-pages {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.pagination button {
  min-width: 42px;
  min-height: 38px;
  padding: 6px 10px;
  color: var(--ink);
  background: var(--white);
  border: 3px solid var(--line);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
  font: inherit;
}

.pagination button:hover,
.pagination button.active {
  color: var(--white);
  background: var(--blue);
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
  box-shadow: 3px 3px 0 var(--ink);
}

.entry {
  position: relative;
  counter-increment: entry-card;
  padding: 28px 28px 28px clamp(76px, 8vw, 96px);
  border-bottom: 4px solid var(--line);
  background:
    linear-gradient(90deg, rgba(255, 213, 31, 0.36) 0 68px, transparent 68px),
    var(--white);
}

.entry:nth-child(2n) {
  background:
    linear-gradient(90deg, rgba(33, 196, 232, 0.34) 0 68px, transparent 68px),
    #fffdf8;
}

.entry::before {
  content: counter(entry-card, decimal-leading-zero);
  position: absolute;
  top: 28px;
  left: 18px;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--white);
  background: var(--red);
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 950;
  transform: rotate(-4deg);
}

.entry:last-child {
  border-bottom: 0;
}

.entry-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.entry h3 {
  margin: 0;
  font-family: var(--font-serif);
  color: var(--ink);
  font-size: clamp(34px, 4.6vw, 54px);
  font-weight: 950;
  line-height: 1.08;
}

.erhua {
  display: inline-block;
  margin-left: 0.02em;
  color: currentColor;
  font-size: 0.66em;
  font-weight: inherit;
  line-height: 1;
  vertical-align: baseline;
}

.pos {
  flex: 0 0 auto;
  padding: 3px 10px;
  color: var(--ink);
  background: var(--yellow);
  border: 3px solid var(--line);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 950;
  white-space: nowrap;
}

.pinyin {
  display: inline-block;
  margin: 12px 0 0;
  padding: 3px 9px;
  color: var(--white);
  background: var(--blue);
  font-family: var(--font-sans);
  font-weight: 950;
}

.variants,
.note,
.example {
  color: var(--muted);
}

.definitions {
  display: grid;
  gap: 14px;
  margin: 18px 0 0;
  padding-left: 0;
  color: var(--ink);
  font-size: 18px;
}

.definition-block {
  display: grid;
  gap: 10px;
}

.definition-text {
  margin: 0;
  font-size: clamp(19px, 2vw, 22px);
}

.definition-number {
  margin-right: 8px;
  color: var(--red);
  font-weight: 950;
}

.note {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 10px;
  margin: 10px 0 0;
  padding: 10px 12px;
  background:
    linear-gradient(90deg, rgba(255, 213, 31, 0.5) 0 42px, transparent 42px),
    #fffaf0;
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 rgba(17, 17, 17, 0.16);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
}

.note span {
  display: grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  color: var(--white);
  background: var(--green);
  border: 2px solid var(--line);
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
}

.note p {
  margin: 0;
}

.entry-note {
  max-width: 780px;
}

.definition-note {
  max-width: 720px;
}

.entry-figure {
  display: block;
  width: min(280px, 100%);
  margin: 18px 0 0;
  background: var(--white);
  border: 4px solid var(--line);
  line-height: 0;
  box-shadow: 6px 6px 0 var(--cyan), 10px 10px 0 rgba(17, 17, 17, 0.18);
}

.entry-figure img {
  display: block;
  width: 100%;
  height: auto;
  background:
    radial-gradient(circle at 1px 1px, rgba(17, 17, 17, 0.12) 1px, transparent 1.4px) 0 0 / 14px 14px,
    #fffdf8;
}

.example {
  margin-top: 14px;
  padding: 14px 16px;
  background: #fff2c2;
  border-left: 7px solid var(--red);
  border-top: 3px solid var(--line);
  border-bottom: 3px solid var(--line);
  box-shadow: 4px 4px 0 rgba(17, 17, 17, 0.18);
}

.example p,
.variants {
  margin: 7px 0 0;
}

.tags {
  display: none;
}

.empty {
  margin: 0;
  padding: 34px 22px;
  color: var(--muted);
  text-align: center;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 22px clamp(18px, 5vw, 56px);
  color: var(--white);
  background: var(--ink);
  border-top: 4px solid var(--red);
  font-family: var(--font-sans);
  font-weight: 950;
}

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

.footer-mark {
  width: 1.45em;
  height: 1.45em;
  object-fit: contain;
  flex: 0 0 auto;
}

/* ===== Modal ===== */
.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: clamp(8px, 3vw, 32px);
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.18) 1px, transparent 1.4px) 0 0 / 14px 14px,
    rgba(17, 17, 17, 0.72);
  cursor: pointer;
}

.modal-window {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1080px, 100%);
  max-height: min(880px, 92vh);
  overflow: hidden;
  background: var(--white);
  border: 4px solid var(--line);
  box-shadow: 12px 12px 0 var(--yellow), 18px 18px 0 var(--ink);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  color: var(--white);
  background: var(--red);
  border-bottom: 4px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 950;
}

.modal-kicker {
  margin: 0 0 4px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.modal-close {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  padding: 0;
  color: var(--ink);
  background: var(--yellow);
  border: 3px solid var(--line);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 950;
  line-height: 1;
}

.modal-close:hover {
  color: var(--white);
  background: var(--blue);
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.modal-body {
  display: grid;
  grid-template-columns: minmax(180px, 232px) minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
}

.doc-nav {
  padding: 16px;
  background:
    linear-gradient(90deg, rgba(255, 213, 31, 0.5) 0 48%, transparent 48%),
    var(--paper);
  border-right: 4px solid var(--line);
  overflow-y: auto;
}

.doc-nav ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.doc-nav button,
.initial-grid button {
  width: 100%;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--white);
  border: 3px solid var(--line);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  font-weight: 950;
  text-align: left;
}

.doc-nav button:hover,
.doc-nav button.active,
.initial-grid button:hover,
.initial-grid button.active {
  color: var(--white);
  background: var(--red);
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink);
}

.doc-view {
  min-height: 0;
  padding: 28px clamp(20px, 4vw, 40px);
  overflow-y: auto;
  background: var(--white);
}

.doc-view:focus {
  outline: none;
}

.doc-view h1,
.doc-view h2,
.doc-view h3,
.doc-view h4 {
  font-weight: 950;
  line-height: 1.25;
}

.doc-view h1 {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 28px;
  padding: 8px 18px 10px;
  color: var(--ink);
  background: var(--white);
  border: 4px solid var(--line);
  box-shadow: 6px 6px 0 var(--yellow);
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.16;
  text-align: center;
  text-shadow: none;
  white-space: normal;
}

.doc-view h2 {
  display: inline-block;
  margin: 28px 0 12px;
  padding: 4px 10px;
  background: var(--yellow);
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 22px;
}

.doc-view h3 {
  margin: 22px 0 10px;
  color: var(--red);
  font-size: 18px;
}

.doc-view p,
.doc-view li {
  font-size: 16px;
}

.doc-view code {
  padding: 1px 6px;
  color: var(--ink);
  background: #fff2c2;
  border: 2px solid var(--line);
  font-family: Consolas, monospace;
  font-size: 14px;
}

.doc-view pre {
  margin: 14px 0;
  padding: 14px 16px;
  background: #fff2c2;
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 var(--ink);
  overflow-x: auto;
}

.doc-view pre code {
  padding: 0;
  background: transparent;
  border: 0;
}

.doc-view blockquote {
  margin: 14px 0;
  padding: 10px 16px;
  background: #fff2c2;
  border-left: 7px solid var(--red);
  border-top: 3px solid var(--line);
  border-bottom: 3px solid var(--line);
}

.doc-view table {
  width: 100%;
  margin: 14px 0;
  border-collapse: collapse;
  border: 3px solid var(--line);
  box-shadow: 5px 5px 0 var(--ink);
  background: var(--white);
}

.doc-view thead {
  color: var(--white);
  background: var(--blue);
}

.doc-view th,
.doc-view td {
  padding: 8px 12px;
  border: 2px solid var(--line);
  text-align: left;
}

.doc-view tbody tr:nth-child(2n) {
  background: #fffdf2;
}

.index-window {
  width: min(720px, 100%);
}

.welcome-window {
  width: min(900px, calc(100vw - 40px));
  height: min(760px, calc(100vh - 56px));
  max-height: calc(100vh - 56px);
  overflow: visible;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.welcome-close {
  position: absolute;
  right: max(8px, calc((100% - 790px) / 2 - 20px));
  top: 8px;
  z-index: 8;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  padding: 0;
  color: var(--ink);
  background: var(--white);
  border: 4px solid var(--line);
  border-radius: 50%;
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 950;
  line-height: 1;
}

.welcome-close:hover,
.welcome-close:focus-visible {
  color: var(--white);
  background: #146b45;
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink);
}

.welcome-stage {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  width: min(790px, 100%);
  height: 100%;
  margin: 0 auto;
  padding: clamp(14px, 3vw, 28px);
  isolation: isolate;
  overflow: visible;
}

.welcome-card {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: 46px auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  height: 100%;
  background:
    radial-gradient(circle at 88% 18%, rgba(0, 120, 216, 0.16) 0 54px, transparent 55px),
    linear-gradient(118deg, transparent 0 63%, rgba(255, 213, 31, 0.48) 63% 73%, transparent 73%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.95)),
    linear-gradient(90deg, rgba(20, 107, 69, 0.08), rgba(217, 15, 47, 0.08));
  border: 4px solid var(--line);
  box-shadow: 10px 10px 0 #d90f2f, 16px 16px 0 var(--ink);
  overflow: hidden;
}

.welcome-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 1px 1px, rgba(17, 17, 17, 0.08) 1px, transparent 1.5px) 0 0 / 18px 18px,
    linear-gradient(90deg, #146b45 0 9px, transparent 9px calc(100% - 9px), #d90f2f calc(100% - 9px) 100%);
  pointer-events: none;
}

.welcome-card::after {
  content: "CQ-PEDIA";
  position: absolute;
  right: clamp(14px, 3vw, 34px);
  bottom: -8px;
  z-index: 0;
  color: rgba(17, 17, 17, 0.06);
  font-family: var(--font-sans);
  font-size: clamp(54px, 9vw, 118px);
  font-weight: 950;
  line-height: 0.9;
  white-space: nowrap;
}

.welcome-scorebar {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  min-height: 46px;
  color: var(--white);
  background: var(--ink);
  border-bottom: 4px solid var(--line);
  font-family: var(--font-sans);
  font-size: clamp(11px, 1.5vw, 13px);
  font-weight: 950;
  letter-spacing: 0;
  text-align: center;
}

.welcome-scorebar span {
  min-width: 0;
  overflow: hidden;
  padding: 0 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.welcome-scorebar strong {
  align-self: stretch;
  display: grid;
  min-width: 84px;
  place-items: center;
  color: var(--ink);
  background: var(--yellow);
  border-left: 4px solid var(--line);
  border-right: 4px solid var(--line);
  font-size: 21px;
  line-height: 1;
}

.welcome-hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px 16px;
  align-items: end;
  padding: clamp(18px, 3vw, 28px) clamp(22px, 5vw, 50px) 16px;
  color: var(--ink);
  background: transparent;
}

.welcome-hero > * {
  min-width: 0;
}

.welcome-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  padding: 6px 11px;
  background: var(--white);
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 #0078d8;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 950;
}

.welcome-brand img {
  width: 28px;
  height: 28px;
}

.welcome-kicker {
  align-self: center;
  width: max-content;
  max-width: 100%;
  margin: 0;
  padding: 6px 12px;
  color: var(--white);
  background: #146b45;
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 950;
  line-height: 1.2;
}

.welcome-hero h2 {
  grid-column: 1 / -1;
  max-width: 760px;
  margin: 10px 0 0;
  font-family: var(--font-serif);
  font-weight: 950;
  line-height: 0.98;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.welcome-title-prefix,
.welcome-title-main {
  display: block;
  font-family: inherit;
  font-weight: inherit;
  letter-spacing: 0;
}

.welcome-title-prefix {
  margin-bottom: 0;
  font-size: clamp(22px, 3.2vw, 42px);
  line-height: 1.02;
  text-shadow: 3px 3px 0 var(--white), 7px 7px 0 var(--red);
}

.welcome-title-main {
  color: var(--ink);
  font-size: clamp(46px, 6.8vw, 86px);
  line-height: 0.98;
  text-shadow: 3px 3px 0 var(--white), 7px 7px 0 var(--red);
}

.welcome-hero p {
  grid-column: 1 / -1;
  align-self: center;
  margin: 0;
  font-size: clamp(15px, 2.1vw, 18px);
  font-weight: 850;
  line-height: 1.55;
}

.welcome-announcement {
  position: relative;
  z-index: 1;
  min-height: 0;
  margin: 8px clamp(22px, 5vw, 50px) 16px;
  padding: clamp(18px, 2.7vw, 24px);
  background: rgba(255, 255, 255, 0.88);
  border: 3px solid var(--line);
  box-shadow: 5px 5px 0 rgba(17, 17, 17, 0.16);
  overflow-x: hidden;
  overflow-y: auto;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.welcome-announcement p {
  margin: 0;
  font-size: 16px;
}

.welcome-announcement li {
  font-size: 16px;
}

.welcome-announcement p + p {
  margin-top: 10px;
}

.welcome-announcement h1 {
  display: inline-block;
  margin: 0 0 14px;
  padding: 4px 10px;
  background: var(--yellow);
  border: 3px solid var(--line);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 19px;
  font-weight: 950;
  line-height: 1.25;
  color: var(--ink);
  text-shadow: none;
}

.welcome-actions {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) repeat(2, minmax(140px, 1fr));
  gap: 10px;
  padding: 0 clamp(22px, 5vw, 50px) clamp(22px, 4vw, 30px);
}

.welcome-actions button {
  min-width: 0;
  min-height: 46px;
  padding: 8px 16px;
  color: var(--ink);
  background: var(--white);
  border: 3px solid var(--line);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 950;
  overflow-wrap: anywhere;
}

.welcome-actions .welcome-primary {
  color: var(--white);
  background: #d90f2f;
  font-size: 18px;
}

.welcome-actions button:hover,
.welcome-actions button:focus-visible {
  color: var(--white);
  background: #0078d8;
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink);
}

.index-window .index-tabs {
  flex: 0 0 auto;
}

.index-window .initial-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.about-window {
  width: min(860px, 100%);
}

.about-content {
  display: grid;
  gap: 18px;
  padding: 22px;
  background: var(--paper);
  overflow-y: auto;
}

.about-section {
  padding: 18px;
  background: var(--white);
  border: 3px solid var(--line);
  box-shadow: 5px 5px 0 var(--ink);
}

.about-section h3 {
  display: inline-block;
  margin: 0 0 16px;
  padding: 4px 10px;
  background: var(--yellow);
  border: 3px solid var(--line);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 18px;
  font-weight: 950;
}

.about-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.about-list div {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 14px;
  align-items: baseline;
}

.about-list dt {
  font-family: var(--font-sans);
  font-weight: 950;
}

.about-list dd {
  margin: 0;
  word-break: break-word;
}

.about-list a {
  color: var(--blue);
  font-weight: 900;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.about-list a:hover {
  color: var(--red);
}

.author-section {
  padding: 24px;
  background:
    radial-gradient(circle at 1px 1px, rgba(17, 17, 17, 0.1) 1px, transparent 1.5px) 0 0 / 16px 16px,
    var(--white);
}

.author-section > h3 {
  justify-self: start;
  width: fit-content;
}

.author-copy {
  min-width: 0;
  text-align: center;
}

.author-role {
  width: fit-content;
  margin-bottom: 10px;
  padding: 3px 9px;
  color: var(--white);
  background: var(--blue);
  border: 3px solid var(--line);
  box-shadow: 3px 3px 0 var(--ink);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 950;
}

.author-name {
  margin: 0;
  font-family: var(--font-sans);
  font-size: clamp(42px, 6vw, 58px);
  font-weight: 950;
  line-height: 1;
  text-shadow: 2px 2px 0 var(--white), 4px 4px 0 var(--red);
}

.author-email {
  width: fit-content;
  max-width: 100%;
  margin: 14px auto 0;
  padding: 6px 10px;
  background: var(--paper);
  border: 3px solid var(--line);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 950;
  word-break: break-word;
}

.author-section .donate-code {
  width: min(240px, 100%);
  margin: 20px auto 0;
  padding: 12px;
  background: var(--white);
  border: 3px solid var(--line);
  box-shadow: 5px 5px 0 var(--yellow);
}

.author-section .donate-code img {
  width: 100%;
  height: auto;
  border: 0;
  box-shadow: none;
}

.donate-code,
.survey-code {
  display: grid;
  place-items: center;
  margin: 0;
}

.donate-code img,
.survey-code img {
  width: min(280px, 100%);
  height: auto;
  border: 3px solid var(--line);
  box-shadow: 5px 5px 0 var(--yellow);
}

.survey-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.survey-link:hover .survey-code img,
.survey-link:focus-visible .survey-code img {
  transform: translate(2px, 2px);
  box-shadow: 3px 3px 0 var(--blue);
}

.feedback-window {
  width: min(760px, 100%);
}

.feedback-tabs {
  display: flex;
  background: var(--yellow);
  border-bottom: 4px solid var(--line);
}

.feedback-tabs button {
  flex: 1 1 0;
  padding: 12px 14px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-right: 3px solid var(--line);
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 950;
}

.feedback-tabs button:last-child {
  border-right: 0;
}

.feedback-tabs button:hover,
.feedback-tabs button.active {
  color: var(--white);
  background: var(--blue);
}

.feedback-content {
  display: grid;
  gap: 18px;
  min-height: 0;
  padding: 22px;
  background: var(--paper);
  overflow-y: auto;
}

.feedback-panel {
  align-content: start;
  gap: 16px;
}

.feedback-panel.active {
  display: grid;
}

.feedback-fieldset {
  margin: 0;
  padding: 14px;
  background: var(--white);
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 var(--ink);
}

.feedback-fieldset legend {
  padding: 3px 8px;
  background: var(--yellow);
  border: 3px solid var(--line);
  font-family: var(--font-sans);
  font-weight: 950;
}

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

.choice-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 10px;
  background: #fffdf8;
  border: 2px solid var(--line);
  font-weight: 900;
}

.choice-grid input {
  width: 18px;
  height: 18px;
  accent-color: var(--red);
}

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

.form-field {
  display: grid;
  gap: 7px;
  min-width: 0;
  font-weight: 900;
}

.form-field.full {
  grid-column: 1 / -1;
}

.form-field span {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 950;
}

.form-field input,
.form-field textarea {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  background: var(--white);
  border: 3px solid var(--line);
  border-radius: 0;
  font: inherit;
  font-size: 15px;
  line-height: 1.6;
}

.form-field input {
  min-height: 44px;
  padding: 8px 10px;
}

.form-field textarea {
  resize: vertical;
  padding: 10px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.form-actions button {
  min-height: 42px;
  padding: 8px 14px;
  color: var(--ink);
  background: var(--yellow);
  border: 3px solid var(--line);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 950;
}

.form-actions button:hover {
  color: var(--white);
  background: var(--red);
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.feedback-status {
  min-height: 1.4em;
  margin: 0;
  font-weight: 900;
  text-align: right;
}

.initial-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 22px;
  background: var(--paper);
}

.initial-grid button {
  min-height: 58px;
  text-align: center;
  font-family: var(--font-sans);
  font-size: 18px;
}

.initial-grid small {
  display: block;
  margin-top: 4px;
  color: inherit;
  opacity: 0.72;
  font-size: 11px;
  font-weight: 800;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.modal-open {
  overflow: hidden;
}

.back-to-search {
  position: fixed;
  right: clamp(16px, 4vw, 32px);
  bottom: clamp(84px, 10vh, 112px);
  z-index: 80;
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  padding: 0;
  color: var(--ink);
  background: var(--yellow);
  border: 4px solid var(--line);
  border-radius: 50%;
  box-shadow: 5px 5px 0 var(--ink);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 160ms ease, transform 160ms ease, background 160ms ease, color 160ms ease;
}

.back-to-search.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-search svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.back-to-search:hover,
.back-to-search:focus-visible {
  color: var(--white);
  background: var(--blue);
  transform: translate(2px, 2px);
  box-shadow: 3px 3px 0 var(--ink);
}

@keyframes rise {
  from {
    opacity: 1;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

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

@media (max-width: 820px) {
  .site-header,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-header {
    padding-bottom: 12px;
  }

  .brand {
    min-height: 68px;
  }

  .top-nav button {
    min-height: 44px;
    border: 3px solid var(--line);
    margin-right: -3px;
    margin-bottom: -3px;
  }

  .page-orb {
    right: -104px;
    top: 130px;
    display: block;
    width: 230px;
    height: 176px;
    opacity: 0.26;
  }

  .hero {
    width: 100vw;
    max-width: 100vw;
    min-height: 360px;
    overflow: hidden;
    padding: 34px 18px 34px;
    background:
      radial-gradient(circle at 1px 1px, rgba(17, 17, 17, 0.13) 1px, transparent 1.5px) 0 0 / 16px 16px,
      linear-gradient(112deg, transparent 0 9%, var(--red) 9% 30%, transparent 30%),
      linear-gradient(104deg, transparent 0 67%, var(--blue) 67% 100%),
      linear-gradient(136deg, rgba(255, 213, 31, 0.2) 0 38%, transparent 38%),
      #fff6d8;
  }

  .hero::before {
    top: 47%;
    width: 86vw;
    height: 150px;
    transform: translate(-50%, -50%) skewX(-8deg);
  }

  .hero-copy::before {
    top: 18px;
    font-size: clamp(50px, 16vw, 76px);
  }

  .hero-copy {
    padding: 18px 12px 24px;
    background: rgba(255, 250, 240, 0.78);
    box-shadow: 5px 5px 0 rgba(17, 17, 17, 0.1);
  }

  .platform-label {
    margin-bottom: 30px;
    font-size: 13px;
  }

  h1 {
    max-width: none;
    font-size: clamp(30px, 8vw, 38px);
    line-height: 1;
    white-space: nowrap;
    text-shadow: 2px 2px 0 var(--white), 4px 4px 0 var(--red);
  }

  .search-form {
    width: min(278px, calc(100vw - 92px));
    margin: 34px auto 0;
    padding: 9px;
    box-shadow: 6px 6px 0 var(--yellow), 10px 10px 0 var(--ink);
  }

  .search-form input {
    min-height: 52px;
    padding-right: 108px;
    font-size: 15px;
  }

  .search-form .search-submit,
  .search-form .filter-toggle {
    width: 40px;
    height: 40px;
  }

  .search-form .search-submit {
    right: 62px;
  }

  .search-form .filter-toggle {
    right: 14px;
  }

  .results-panel {
    margin-top: -18px;
    padding: 0 18px 56px;
  }

  .results-head {
    padding: 12px 14px;
    box-shadow: 6px 6px 0 var(--ink);
  }

  .results {
    box-shadow: 6px 6px 0 var(--yellow), 10px 10px 0 var(--ink);
  }

  .entry {
    padding: 24px 18px 24px 66px;
    background:
      linear-gradient(90deg, rgba(255, 213, 31, 0.36) 0 54px, transparent 54px),
      var(--white);
  }

  .entry:nth-child(2n) {
    background:
      linear-gradient(90deg, rgba(33, 196, 232, 0.34) 0 54px, transparent 54px),
      #fffdf8;
  }

  .entry::before {
    left: 12px;
    top: 26px;
    width: 34px;
    height: 34px;
    font-size: 13px;
  }

  .entry-head,
  .site-footer {
    flex-direction: column;
  }

  .modal-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .doc-nav {
    max-height: 38vh;
    border-right: 0;
    border-bottom: 4px solid var(--line);
  }

  .initial-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .feedback-content {
    grid-template-columns: 1fr;
  }

  .welcome-window {
    width: min(100%, calc(100vw - 34px));
    height: min(710px, calc(100vh - 48px));
    max-height: calc(100vh - 48px);
    overflow: visible;
  }

  .welcome-stage {
    grid-template-columns: 1fr;
    height: 100%;
    padding: 8px;
  }

  .welcome-hero {
    grid-template-columns: 1fr;
    padding: 15px 18px 14px;
    gap: 8px;
  }

  .welcome-hero h2 {
    margin-top: 8px;
    max-width: none;
    line-height: 1.02;
    word-break: keep-all;
  }

  .welcome-title-prefix {
    font-size: clamp(14px, 3.8vw, 18px);
    text-shadow: 2px 2px 0 var(--white), 4px 4px 0 var(--red);
  }

  .welcome-title-main {
    font-size: clamp(30px, 8vw, 38px);
    text-shadow: 2px 2px 0 var(--white), 4px 4px 0 var(--red);
  }

  .welcome-hero p {
    font-size: 15px;
  }

  .welcome-card {
    grid-template-rows: 44px auto minmax(0, 1fr) auto;
    max-height: none;
    box-shadow: 4px 4px 0 #d90f2f, 7px 7px 0 var(--ink);
  }

  .welcome-scorebar {
    min-height: 48px;
    font-size: 10px;
  }

  .welcome-scorebar strong {
    min-width: 84px;
    font-size: 20px;
  }

  .welcome-announcement {
    margin: 8px 18px 14px;
    padding: 16px;
  }

  .welcome-actions {
    grid-template-columns: 1fr;
    padding: 0 18px 18px;
  }
}

@media (max-width: 460px) {
  .welcome-window {
    width: calc(100vw - 28px);
  }

  .welcome-stage {
    padding: 6px;
  }

  .welcome-card {
    box-shadow: 4px 4px 0 #d90f2f, 6px 6px 0 var(--ink);
  }

  .welcome-hero h2 {
    max-width: none;
  }

  .welcome-card {
    grid-template-rows: 42px auto minmax(0, 1fr) auto;
  }

  .welcome-scorebar strong {
    min-width: 72px;
  }

  .welcome-announcement {
    margin-right: 12px;
    margin-left: 12px;
  }

  .welcome-actions {
    padding-right: 12px;
    padding-left: 12px;
  }

  .top-nav button {
    padding: 0 12px;
    font-size: 13px;
  }

  .initial-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .about-list div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .author-section .donate-code img {
    width: min(220px, 100%);
  }

  .feedback-tabs {
    flex-direction: column;
  }

  .feedback-tabs button {
    border-right: 0;
    border-bottom: 3px solid var(--line);
  }

  .feedback-tabs button:last-child {
    border-bottom: 0;
  }

  .choice-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Hero Redesign: clean pop poster ===== */
.page-orb {
  display: none !important;
}

.hero {
  position: relative;
  isolation: isolate;
  min-height: clamp(390px, 34vw, 500px);
  padding: clamp(58px, 6vw, 84px) clamp(18px, 5vw, 72px) clamp(62px, 5vw, 78px);
  background:
    radial-gradient(circle at 1px 1px, rgba(17, 17, 17, 0.16) 1px, transparent 1.5px) 0 0 / 16px 16px,
    linear-gradient(90deg, #ffd51f 0 100%);
  border-bottom: 4px solid var(--line);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(105deg, var(--red) 0 22%, transparent 22%),
    linear-gradient(166deg, transparent 0 54%, var(--blue) 54% 71%, transparent 71%),
    linear-gradient(24deg, transparent 0 70%, rgba(255, 111, 174, 0.5) 70% 100%);
}

.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  height: clamp(62px, 8vw, 110px);
  background: var(--ink);
  border-top: 4px solid var(--red);
}

.hero-copy {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  margin: 0 auto;
  padding: clamp(28px, 4vw, 48px) clamp(18px, 5vw, 56px) clamp(30px, 4vw, 46px);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.94) 0 100%);
  border: 4px solid var(--line);
  box-shadow: 12px 12px 0 var(--red), 18px 18px 0 var(--ink);
}

.hero-copy::before {
  content: "CQ-PEDIA";
  position: absolute;
  left: 50%;
  top: 12px;
  z-index: 0;
  transform: translateX(-50%);
  color: rgba(17, 17, 17, 0.07);
  font-family: var(--font-sans);
  font-size: clamp(70px, 12vw, 150px);
  font-weight: 950;
  line-height: 0.9;
  white-space: nowrap;
}

.hero-copy::after {
  content: "";
  position: absolute;
  right: clamp(16px, 4vw, 54px);
  top: clamp(18px, 3vw, 34px);
  z-index: 0;
  width: clamp(56px, 7vw, 96px);
  aspect-ratio: 1;
  background:
    radial-gradient(circle at 5px 5px, var(--line) 1.8px, transparent 2.6px) 0 0 / 13px 13px,
    var(--yellow);
  border: 3px solid var(--line);
  clip-path: polygon(50% 0, 62% 34%, 98% 34%, 68% 56%, 80% 96%, 50% 72%, 20% 96%, 32% 56%, 2% 34%, 38% 34%);
  opacity: 0.9;
}

.platform-label,
h1,
.search-form,
.filter-panel {
  position: relative;
  z-index: 1;
}

.platform-label {
  margin: 0 auto clamp(20px, 2.6vw, 30px);
}

h1 {
  color: var(--ink);
  font-size: clamp(54px, 8vw, 116px);
  text-shadow: 3px 3px 0 var(--white), 7px 7px 0 var(--red);
}

.search-form {
  width: min(680px, calc(100% - 28px));
  margin: clamp(28px, 4vw, 44px) auto 0;
  background: var(--white);
  box-shadow: 7px 7px 0 var(--yellow), 13px 13px 0 var(--ink);
}

.filter-panel {
  margin-top: 26px;
}

@media (max-width: 820px) {
  .hero {
    min-height: 360px;
    padding: 30px 18px 44px;
  }

  .hero::before {
    background:
      linear-gradient(105deg, var(--red) 0 26%, transparent 26%),
      linear-gradient(166deg, transparent 0 64%, var(--blue) 64% 100%);
  }

  .hero-copy {
    padding: 20px 12px 24px;
    box-shadow: 8px 8px 0 var(--red), 12px 12px 0 var(--ink);
  }

  .hero-copy::before {
    top: 28px;
    font-size: clamp(54px, 17vw, 82px);
  }

  .hero-copy::after {
    width: 54px;
    right: 10px;
    top: 14px;
    opacity: 0.75;
  }

  .platform-label {
    margin-bottom: 28px;
    font-size: 13px;
  }

  h1 {
    font-size: clamp(30px, 8vw, 38px);
    text-shadow: 2px 2px 0 var(--white), 4px 4px 0 var(--red);
  }

  .search-form {
    width: min(278px, calc(100vw - 92px));
    margin-top: 32px;
  }

  .filter-panel {
    width: min(278px, calc(100vw - 92px));
    margin-top: 14px;
    padding: 0;
    box-shadow: none;
  }

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

/* ===== Index Modal Tabs ===== */
.index-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  background: var(--yellow);
  border-bottom: 4px solid var(--line);
}

.index-tabs button {
  min-height: 52px;
  padding: 10px 16px;
  color: var(--ink);
  background: var(--yellow);
  border: 0;
  border-right: 4px solid var(--line);
  border-radius: 0;
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 950;
}

.index-tabs button:last-child {
  border-right: 0;
}

.index-tabs button:hover,
.index-tabs button.active {
  color: var(--white);
  background: var(--blue);
}

.index-tabs button:focus-visible {
  outline: 4px solid var(--red);
  outline-offset: -4px;
}

.initial-grid.word-class-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.initial-grid.word-class-grid button {
  font-size: 16px;
}

@media (max-width: 460px) {
  .index-tabs {
    grid-template-columns: 1fr;
  }

  .index-tabs button {
    border-right: 0;
    border-bottom: 3px solid var(--line);
  }

  .index-tabs button:last-child {
    border-bottom: 0;
  }
}



/* ===== Entry Font Overrides ===== */
.entry h3,
.example,
.example-translation {
  font-family: var(--font-serif);
}

.pinyin,
.example-pinyin {
  font-family: var(--font-phonetic);
}






/* ===== Display Songti Overrides ===== */
h1,
.welcome-title-prefix,
.welcome-title-main,
.entry h3 {
  font-family: var(--font-serif);
  font-weight: 950;
}


/* ===== Must Read Markdown Font Restore ===== */
.doc-view,
.doc-view h1,
.doc-view h2,
.doc-view h3,
.doc-view h4,
.doc-view p,
.doc-view li,
.doc-view th,
.doc-view td,
.doc-view blockquote,
.welcome-announcement,
.welcome-announcement h1,
.welcome-announcement h2,
.welcome-announcement h3,
.welcome-announcement h4,
.welcome-announcement p,
.welcome-announcement li,
.welcome-announcement th,
.welcome-announcement td,
.welcome-announcement blockquote {
  font-family: var(--font-serif);
}

.doc-view code,
.doc-view pre,
.doc-view pre code,
.welcome-announcement code,
.welcome-announcement pre,
.welcome-announcement pre code {
  font-family: Consolas, monospace;
}
