:root {
  --bg: #0a0c14;
  --panel: rgba(14, 17, 28, 0.78);
  --stroke: rgba(130, 145, 190, 0.16);
  --ink: #edeff7;
  --mut: #98a0b8;
  --faint: #646c84;
  --red: #e23c32;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
#wrap {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 560px;
  overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(110% 85% at 50% 115%, rgba(45, 60, 120, 0.22), transparent 55%),
    var(--bg);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
#wrap.drag { cursor: grabbing; }
canvas { position: absolute; inset: 0; display: block; }
#logo {
  position: absolute;
  top: 26px;
  left: 30px;
  z-index: 5;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--red);
  color: white;
  text-decoration: none;
  font-family: "Songti SC", "Noto Serif SC", serif;
  font-size: 22px;
}
#head {
  position: absolute;
  top: calc(50% - 40px);
  left: 30px;
  transform: translateY(-50%);
  max-width: min(680px, 46vw);
  z-index: 5;
  pointer-events: none;
}
h1 {
  margin: 0 0 16px;
  font-family: "Iowan Old Style", Palatino, "Songti SC", "Noto Serif SC", Georgia, serif;
  font-size: clamp(52px, 6.4vw, 92px);
  font-weight: 500;
  line-height: 1.08;
  color: #fff;
}
h1 .rp { color: #ff3b30; }
#head .kicker { margin: 0 0 8px; color: #fff; font-size: 14px; font-weight: 700; }
#head p { margin: 0; max-width: 42ch; color: #c6cde0; font-size: 14px; line-height: 1.6; }
#head p b { color: #fff; }
#head .ctx { margin-top: 10px; color: var(--mut); font-size: 13px; }
#ctas { display: flex; align-items: center; gap: 14px; margin-top: 18px; pointer-events: auto; }
.btn {
  display: inline-flex;
  padding: 9px 16px;
  border: 1px solid rgba(130, 145, 190, 0.35);
  border-radius: 999px;
  background: rgba(20, 24, 38, 0.6);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.btn:hover { background: rgba(130, 145, 190, 0.18); }
.lic { color: var(--faint); font-size: 11px; letter-spacing: 0.14em; }
#legend {
  position: absolute;
  left: 30px;
  bottom: 24px;
  z-index: 5;
  max-height: 46vh;
  overflow: auto;
  padding: 12px 13px;
  border: 1px solid var(--stroke);
  border-radius: 20px;
  background: var(--panel);
  backdrop-filter: blur(10px);
}
.lg-title { margin: 1px 4px 6px; color: var(--faint); font-size: 11px; }
.chip {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 220px;
  padding: 4px 7px;
  border-radius: 8px;
  cursor: pointer;
}
.chip:hover { background: rgba(130, 145, 190, 0.09); }
.chip.off { opacity: 0.32; }
.chip .sw, #tip .sw, #card .sw, .rdot { border-radius: 50%; flex: 0 0 auto; }
.chip .sw { width: 10px; height: 10px; }
.chip .nm { flex: 1; font-size: 13px; }
.chip .ct { color: var(--mut); font-size: 12px; font-variant-numeric: tabular-nums; }
#tip {
  position: absolute;
  z-index: 9;
  max-width: 290px;
  padding: 12px 14px;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  background: rgba(10, 13, 22, 0.95);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
}
#tip.on { opacity: 1; }
#tip .tmeta, #card .cmeta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; color: var(--mut); font-size: 12px; }
#tip .sw, #card .sw { width: 8px; height: 8px; }
#tip .ttl { margin-bottom: 7px; font-size: 15px; font-weight: 700; }
#tip .q, #card .cq { color: #d3d9e8; font-size: 13px; line-height: 1.5; }
#card {
  position: absolute;
  top: 26px;
  right: 26px;
  z-index: 8;
  width: 340px;
  max-height: calc(100vh - 52px);
  overflow: auto;
  padding: 16px 18px 18px;
  border: 1px solid var(--stroke);
  border-radius: 20px;
  background: var(--panel);
  backdrop-filter: blur(13px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
}
#card.on { opacity: 1; pointer-events: auto; transform: none; }
#card .cbar { display: flex; align-items: center; height: 24px; margin-bottom: 8px; }
#card .sp { flex: 1; }
#card .back, #card .close {
  border: 1px solid var(--stroke);
  background: transparent;
  color: var(--mut);
  cursor: pointer;
}
#card .back { display: none; height: 24px; padding: 0 10px; border-radius: 7px; font-size: 12px; }
#card .back.on { display: inline-flex; align-items: center; }
#card .close {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  font-size: 16px;
}
.ctl { margin: 0 0 9px; font-size: 20px; line-height: 1.25; }
.cq { margin: 0 0 14px; }
.big { display: flex; align-items: baseline; gap: 8px; }
.big .n { font-size: 34px; font-weight: 750; line-height: 1; }
.big .u { color: var(--mut); font-size: 13px; }
.sub { margin: 4px 0 0; color: #aeb6cc; font-size: 12px; line-height: 1.5; }
.sec { margin-top: 15px; }
.seclabel { margin-bottom: 7px; color: var(--faint); font-size: 12px; }
.seclabel .k { color: var(--mut); }
.row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  margin: 0 0 3px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.row:hover { border-color: var(--stroke); background: rgba(130, 145, 190, 0.1); }
.rdot { width: 9px; height: 9px; }
.rt { flex: 1; font-size: 13px; line-height: 1.3; }
.ra { color: var(--faint); font-size: 11px; }
.empty { color: var(--faint); font-size: 12px; }
#hint {
  position: absolute;
  right: 26px;
  bottom: 26px;
  z-index: 5;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.7;
  text-align: right;
  pointer-events: none;
}
#hint b { color: var(--mut); font-weight: 600; }
button:focus-visible, .chip:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
@media (max-width: 900px) {
  #head { max-width: min(92vw, 560px); top: 78px; transform: none; }
  h1 { font-size: 42px; }
  #legend { left: 14px; bottom: 14px; max-height: 28vh; }
  .chip { min-width: 0; }
  #card { top: auto; right: 14px; bottom: 14px; left: 14px; width: auto; max-height: 58vh; }
  #hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
