:root {
  --bg: #f7fcff;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --ink: #1b1f2a;
  --muted: #5f7180;
  --line: #dcecf2;
  --primary: #23c7d9;
  --primary-dark: #0e8fa6;
  --primary-light: #d7f8ff;
  --accent: #ff5fa8;
  --accent-light: #ffe1f0;
  --gold: #d6a84f;
  --shadow: 0 20px 70px rgba(14, 143, 166, 0.14);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--ink);
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(120deg, rgba(35, 199, 217, 0.18), transparent 32%),
    linear-gradient(250deg, rgba(255, 95, 168, 0.11), transparent 28%),
    linear-gradient(90deg, rgba(14, 143, 166, 0.07) 1px, transparent 1px),
    linear-gradient(180deg, rgba(14, 143, 166, 0.06) 1px, transparent 1px),
    var(--bg);
  background-size:
    100% 460px,
    100% 420px,
    42px 42px,
    42px 42px;
  background-repeat: no-repeat, no-repeat, repeat, repeat;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.65;
}

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

button,
input,
select {
  font: inherit;
}

main {
  width: 100%;
}

.app-shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}

.content-shell {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding-left: 8px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  gap: 22px;
  align-items: stretch;
  align-self: start;
  padding: 22px 16px;
  border-right: 1px solid rgba(220, 236, 242, 0.9);
  background: rgba(247, 252, 255, 0.84);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  min-width: 180px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(35, 199, 217, 0.26);
  border-radius: 8px;
  background: var(--surface);
  box-shadow:
    0 8px 22px rgba(35, 199, 217, 0.26),
    0 0 0 3px rgba(215, 248, 255, 0.92);
  font-weight: 800;
}

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

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
  line-height: 1.15;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.site-nav {
  display: grid;
  gap: 6px;
  align-items: center;
  justify-content: stretch;
}

.site-nav a {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.header-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: start;
  margin-top: auto;
}

.language-control {
  display: grid;
  gap: 4px;
}

.translation-note {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}

.icon-button,
.lang-toggle,
.primary-link {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-weight: 650;
}

.icon-button:hover,
.lang-toggle:hover {
  border-color: rgba(35, 199, 217, 0.55);
  background: var(--primary-light);
  color: var(--primary-dark);
}

.icon-button,
.lang-toggle {
  padding: 0 12px;
}

.primary-link {
  padding: 0 14px;
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 10px 24px rgba(35, 199, 217, 0.22);
}

.page-hero {
  position: relative;
  overflow: hidden;
  padding: 76px 0 36px;
}

.page-hero::after {
  content: none;
}

.page-hero::before {
  content: none;
}

.page-hero > * {
  position: relative;
  z-index: 1;
}

.hero-copy {
  max-width: 680px;
}

.hero-quips {
  position: absolute;
  right: clamp(16px, 3vw, 36px);
  top: clamp(72px, 8vw, 110px);
  z-index: 2;
  display: grid;
  gap: 6px;
  justify-items: end;
  width: min(700px, 58vw);
  pointer-events: none;
}

.hero-quip {
  display: block;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #8a9aa7;
  font-size: clamp(26px, 3vw, 48px);
  font-weight: 900;
  font-style: italic;
  line-height: 1.05;
  padding: 0;
  text-shadow:
    2px 2px 0 rgba(255, 255, 255, 0.9),
    0 10px 28px rgba(14, 143, 166, 0.16);
  transform: rotate(7deg);
  transform-origin: right center;
  text-align: right;
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(38px, 7vw, 72px);
  line-height: 0.98;
  letter-spacing: 0;
  text-shadow: 0 8px 28px rgba(35, 199, 217, 0.16);
}

h2 {
  margin-bottom: 10px;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
  line-height: 1.3;
}

.page-hero p,
.section-header p,
.lead {
  color: var(--muted);
}

.section-header {
  margin: 36px 0 16px;
}

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

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

.card,
.data-card,
.notice {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.84);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 14px 32px rgba(14, 143, 166, 0.07);
  backdrop-filter: blur(10px);
}

.card,
.data-card {
  padding: 18px;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.card:hover,
.data-card:hover {
  border-color: rgba(35, 199, 217, 0.76);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 18px 40px rgba(35, 199, 217, 0.14);
  transform: translateY(-1px);
}

.card p,
.data-card p {
  margin-bottom: 0;
  color: var(--muted);
  white-space: pre-line;
}

.character-card-head {
  display: flex;
  gap: 10px;
  align-items: start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.character-card-head h3 {
  min-width: 0;
  margin-bottom: 0;
  overflow-wrap: anywhere;
}

.character-badges {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.term-pair {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
  margin-bottom: 10px;
}

.term-pair h3 {
  margin-bottom: 0;
}

.term-equivalent {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border: 1px solid rgba(255, 95, 168, 0.2);
  border-radius: 8px;
  background: rgba(255, 225, 240, 0.5);
  color: #a84c74;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.3;
  padding: 1px 8px;
}

.character-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.character-facts div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(247, 252, 255, 0.68);
  padding: 8px;
}

.character-facts dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.character-facts dd {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.meta-row,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.meta-row {
  margin-bottom: 12px;
}

.pill,
.rarity-pill,
.tag {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.pill {
  padding: 2px 9px;
  background: linear-gradient(135deg, var(--primary-light), rgba(255, 225, 240, 0.9));
  color: var(--primary-dark);
}

.rarity-pill {
  min-width: 28px;
  justify-content: center;
  padding: 2px 9px;
  border: 1px solid transparent;
}

.rarity-pill[data-rarity-tier="S"] {
  border-color: #eadcae;
  background: #fff6d8;
  color: #8a6a22;
}

.rarity-pill[data-rarity-tier="A"] {
  border-color: #ddd3f8;
  background: #f3edff;
  color: #6650a6;
}

.tag {
  padding: 1px 8px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.tool-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.page-action-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  margin: -12px 0 18px;
}

.copy-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(35, 199, 217, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--primary-dark);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  padding: 0 12px;
  box-shadow: 0 8px 20px rgba(14, 143, 166, 0.06);
}

.copy-button:hover {
  border-color: rgba(35, 199, 217, 0.42);
  background: rgba(215, 248, 255, 0.5);
}

.copy-status {
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 800;
}

.filter-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}

.filter-control {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.filter-control span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.filter-control select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
}

.filter-control select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(35, 199, 217, 0.18);
  outline: none;
}

.filter-count {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.filter-input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 12px;
  color: var(--ink);
}

.filter-input:focus,
.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(35, 199, 217, 0.18);
  outline: none;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 38px rgba(14, 143, 166, 0.08);
}

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

.data-table th {
  background: linear-gradient(180deg, var(--primary-light), rgba(255, 255, 255, 0.92));
  color: var(--primary-dark);
  font-size: 13px;
  white-space: nowrap;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.table-scroll {
  overflow-x: auto;
}

.affinity-table {
  min-width: 760px;
}

.affinity-table th[scope="row"] {
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
  white-space: nowrap;
}

.gift-name,
.gift-value {
  display: block;
}

.gift-name {
  color: var(--ink);
  font-weight: 850;
}

.gift-value {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.level-table-wrap {
  max-width: 520px;
}

.level-table .total-row td {
  background: rgba(215, 248, 255, 0.52);
  color: var(--primary-dark);
  font-weight: 900;
}

.external-link {
  color: var(--primary-dark);
  font-weight: 800;
}

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

.source-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 12px;
  font-size: 13px;
}

.page-meta-corner {
  display: flex;
  justify-content: flex-end;
  margin-top: -18px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.bug-card {
  position: relative;
  padding-right: 92px;
}

.fix-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #ff5f6f;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  padding: 2px 10px;
  box-shadow: 0 8px 18px rgba(255, 95, 111, 0.22);
}

.fix-badge.partial {
  background: var(--gold);
  box-shadow: 0 8px 18px rgba(214, 168, 79, 0.24);
}

.bug-source {
  margin-top: 14px;
}

.bug-source a {
  color: var(--primary-dark);
  font-weight: 850;
}

.bug-source a:hover {
  color: var(--accent);
}

.notice {
  margin: 28px 0;
  padding: 16px 18px;
  border-color: rgba(255, 95, 168, 0.28);
  background: linear-gradient(135deg, rgba(255, 225, 240, 0.72), rgba(255, 255, 255, 0.88));
  color: var(--muted);
}

.small-note {
  font-size: 14px;
}

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

.contact-list div {
  display: grid;
  gap: 2px;
}

.contact-list dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.contact-list dd {
  margin: 0;
  color: var(--ink);
  font-weight: 750;
  overflow-wrap: anywhere;
}

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

.search-panel {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(27, 31, 42, 0.36);
  backdrop-filter: blur(5px);
}

.search-dialog {
  position: relative;
  width: min(720px, calc(100% - 28px));
  max-height: min(720px, calc(100vh - 48px));
  margin: 24px auto;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  padding: 18px;
}

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

.search-input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
}

.search-status {
  margin: 12px 0;
  color: var(--muted);
  font-size: 14px;
}

.search-results {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.search-results a {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.search-results a:hover {
  border-color: rgba(255, 95, 168, 0.48);
  background: linear-gradient(135deg, rgba(215, 248, 255, 0.58), rgba(255, 225, 240, 0.38));
}

.search-results span {
  color: var(--muted);
}

.site-footer {
  width: 100%;
  margin: 54px 0 0;
  padding: 24px 0 36px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.site-footer p {
  margin-bottom: 4px;
}

@media (max-width: 920px) {
  .app-shell {
    display: block;
  }

  .content-shell {
    width: min(1120px, calc(100% - 32px));
    padding-left: 0;
  }

  .site-header {
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid rgba(220, 236, 242, 0.9);
  }

  .site-nav {
    display: flex;
    grid-column: 1 / -1;
    justify-content: start;
    order: 3;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .site-nav a {
    flex: 0 0 auto;
    padding: 8px 10px;
    font-size: 14px;
  }

  .header-actions {
    flex-direction: row;
    margin-top: 0;
  }

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

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

@media (max-width: 640px) {
  .content-shell {
    width: min(100% - 24px, 1120px);
  }

  .site-header {
    padding: 12px;
  }

  .brand {
    min-width: 0;
  }

  .header-actions {
    gap: 6px;
  }

  .icon-button,
  .lang-toggle {
    min-height: 36px;
    padding: 0 9px;
    font-size: 13px;
  }

  .page-hero {
    padding-top: 42px;
  }

  .hero-quips {
    position: absolute;
    right: 18px;
    left: auto;
    top: 34px;
    width: min(620px, 70vw);
    justify-items: end;
    margin-top: 0;
  }

  .hero-quip {
    font-size: clamp(18px, 5vw, 34px);
    transform: rotate(6deg);
  }

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

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

  .data-table {
    display: block;
    overflow-x: auto;
  }
}
