:root {
  --bg: #0e121d;
  --bg-2: #17191f;
  --ink: #f0ead7;
  --muted: #aaa99d;
  --line: rgba(224, 182, 95, 0.2);
  --gold: #e0b65f;
  --jade: #63b58b;
  --cinnabar: #d86a55;
  --violet: #b8a5ff;
  --panel: rgba(20, 19, 18, 0.82);
  --panel-strong: rgba(20, 19, 18, 0.94);
  --ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", "Songti SC", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  font-family: var(--serif);
  overflow: hidden;
  background:
    radial-gradient(circle at 74% 18%, rgba(216, 106, 85, 0.22), transparent 28%),
    linear-gradient(180deg, rgba(14, 18, 29, 0.58), rgba(14, 18, 29, 0.9)),
    url("../assets/three-kingdoms-war-map.png") center / cover fixed,
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

#cosmosCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  opacity: 0.54;
  pointer-events: none;
}

#app,
#stage,
#graphSvg {
  position: fixed;
  inset: 0;
}

#app {
  z-index: 1;
}

#stage {
  z-index: 1;
}

#graphSvg {
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#graphSvg.panning {
  cursor: grabbing;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20;
  width: min(680px, calc(100vw - 24px));
  padding: 18px 22px 28px;
  background: linear-gradient(135deg, rgba(10, 13, 24, 0.86), rgba(10, 13, 24, 0.32) 72%, transparent);
  pointer-events: none;
}

.cornerActions,
.seriesLink,
.brand,
.viewnav,
.controls {
  pointer-events: auto;
}

.cornerActions {
  position: fixed;
  top: 20px;
  right: 22px;
  z-index: 24;
  display: flex;
  align-items: center;
  gap: 8px;
}

.seriesLink,
.rewardBtn {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(224, 182, 95, 0.22);
  border-radius: 999px;
  padding: 0 15px;
  background: rgba(14, 18, 29, 0.64);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-decoration: none;
  backdrop-filter: blur(10px) saturate(1.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 12px 28px rgba(0, 0, 0, 0.2);
  transition: transform 0.18s, border-color 0.18s, background 0.18s;
}

.rewardBtn {
  color: #17130a;
  border-color: rgba(224, 182, 95, 0.72);
  background: linear-gradient(180deg, #e0b65f, #c9913d);
  cursor: pointer;
  font-weight: 700;
}

.seriesLink:hover,
.rewardBtn:hover {
  transform: translateY(-1px);
  border-color: rgba(224, 182, 95, 0.54);
  background: rgba(34, 28, 22, 0.82);
}

.rewardBtn:hover {
  background: linear-gradient(180deg, #f0ca76, #d19a45);
}

.rewardOverlay {
  position: fixed;
  inset: 0;
  z-index: 42;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(6, 8, 14, 0.66);
  backdrop-filter: blur(10px) saturate(1.1);
}

.rewardOverlay[hidden] {
  display: none;
}

.rewardModal {
  position: relative;
  width: min(500px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 24px 20px 20px;
  border: 1px solid rgba(224, 182, 95, 0.5);
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 16%, rgba(224, 182, 95, 0.18), transparent 34%),
    radial-gradient(circle at 88% 78%, rgba(216, 106, 85, 0.14), transparent 36%),
    linear-gradient(180deg, rgba(37, 31, 25, 0.96), rgba(18, 19, 25, 0.98));
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.rewardClose {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(240, 234, 215, 0.18);
  border-radius: 8px;
  background: rgba(240, 234, 215, 0.08);
  color: var(--ink);
  cursor: pointer;
  font-size: 25px;
  line-height: 1;
}

.rewardEyebrow {
  margin: 0 42px 10px 0;
  color: var(--gold);
  font-family: var(--ui);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.rewardModal h2 {
  margin: 0;
  max-width: calc(100% - 48px);
  font-size: clamp(30px, 4.3vw, 38px);
  line-height: 1.08;
  letter-spacing: 0;
  white-space: nowrap;
}

.rewardCopy,
.rewardFoot {
  margin: 12px 0 0;
  color: rgba(240, 234, 215, 0.86);
  font-size: 14px;
  line-height: 1.74;
}

.rewardQrWrap {
  display: grid;
  place-items: center;
  gap: 8px;
  margin-top: 18px;
  border: 1px dashed rgba(224, 182, 95, 0.48);
  border-radius: 8px;
  padding: 17px 14px 16px;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.08), transparent 42%),
    rgba(255, 255, 255, 0.035);
}

.rewardQr {
  width: min(300px, 76vw);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.36);
}

.rewardQrWrap strong {
  color: var(--ink);
  font-family: var(--ui);
  font-size: 13px;
}

.rewardFoot {
  margin-top: 13px;
  color: rgba(240, 234, 215, 0.72);
}

.brand {
  display: flex;
  align-items: flex-end;
  gap: 14px;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(27px, 4vw, 43px);
  font-weight: 650;
  letter-spacing: 0.12em;
  line-height: 1;
}

h1 span {
  color: var(--gold);
}

.brand p,
.readerHead p,
.detailTitle p,
.detailTitle span {
  margin: 0;
  font-family: var(--ui);
  color: var(--muted);
}

.brand p {
  margin-top: 8px;
  font-size: 12px;
  letter-spacing: 0.18em;
}

.viewnav,
.controls,
#legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.viewnav {
  margin-top: 16px;
}

.viewnav button,
.ghostBtn,
.factionChip,
.searchBox {
  min-height: 34px;
  border: 1px solid rgba(238, 240, 223, 0.12);
  background: rgba(14, 18, 32, 0.62);
  color: var(--muted);
  border-radius: 999px;
  backdrop-filter: blur(8px) saturate(1.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 12px 28px rgba(0, 0, 0, 0.18);
}

.viewnav button,
.ghostBtn {
  padding: 0 16px;
  cursor: pointer;
  font-family: var(--ui);
  font-size: 12px;
  letter-spacing: 0.08em;
  transition: color 0.18s, background 0.18s, border-color 0.18s, transform 0.18s;
}

.viewnav button:hover,
.ghostBtn:hover {
  transform: translateY(-1px);
  color: var(--ink);
  border-color: rgba(240, 195, 90, 0.45);
}

.viewnav button.active {
  background: var(--gold);
  color: #19170e;
  border-color: var(--gold);
}

.controls {
  margin-top: 10px;
  align-items: center;
}

.searchBox {
  position: relative;
  width: min(300px, 54vw);
  display: flex;
  align-items: center;
  padding: 0 14px;
}

.searchBox span {
  width: 8px;
  height: 8px;
  margin-right: 9px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 16px rgba(240, 195, 90, 0.8);
}

.searchBox input {
  width: 100%;
  height: 34px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-family: var(--ui);
  font-size: 13px;
}

.searchBox input::placeholder {
  color: rgba(238, 240, 223, 0.48);
}

.returnBtn {
  display: none;
}

body.can-return .returnBtn {
  display: inline-flex;
  align-items: center;
}

.studentMissionDock {
  position: fixed;
  right: 22px;
  bottom: 18px;
  z-index: 21;
  width: min(380px, calc(100vw - 44px));
  padding: 16px;
  border: 1px solid rgba(224, 182, 95, 0.22);
  border-radius: 8px;
  background:
    radial-gradient(circle at 12% 18%, rgba(224, 182, 95, 0.15), transparent 34%),
    linear-gradient(145deg, rgba(26, 24, 22, 0.9), rgba(11, 14, 23, 0.84));
  box-shadow: 0 24px 58px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px) saturate(1.25);
  pointer-events: auto;
  transition: opacity 0.22s, transform 0.22s;
}

body.detail-open .studentMissionDock,
body[data-view="timeline"] .studentMissionDock,
body[data-view="artifacts"] .studentMissionDock {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
}

.studentMissionKicker {
  margin: 0 0 6px;
  color: var(--gold);
  font-family: var(--ui);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.studentMissionDock h2 {
  margin: 0 0 13px;
  font-size: 24px;
  letter-spacing: 0.05em;
  line-height: 1.18;
}

.missionCardGrid {
  display: grid;
  gap: 8px;
}

.missionCard {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  column-gap: 11px;
  row-gap: 2px;
  border: 1px solid rgba(240, 234, 215, 0.1);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: transform 0.16s, border-color 0.16s, background 0.16s;
}

.missionCard:hover,
.missionCard:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(224, 182, 95, 0.34);
  background: rgba(255, 255, 255, 0.065);
}

.missionCard.primary {
  border-color: rgba(99, 181, 139, 0.34);
  background: rgba(99, 181, 139, 0.12);
}

.missionCard span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(224, 182, 95, 0.16);
  color: var(--gold);
  font-family: var(--ui);
  font-size: 11px;
  font-weight: 800;
}

.missionCard strong,
.missionCard small {
  min-width: 0;
  font-family: var(--ui);
}

.missionCard strong {
  font-size: 13px;
  letter-spacing: 0.04em;
}

.missionCard small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

#legend {
  position: fixed;
  left: 22px;
  bottom: 18px;
  z-index: 20;
  max-width: min(760px, calc(100vw - 150px));
  pointer-events: auto;
}

.factionChip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px 7px 8px;
  cursor: pointer;
  user-select: none;
  font-family: var(--ui);
  font-size: 11px;
  letter-spacing: 0.06em;
  transition: opacity 0.18s, border-color 0.18s, transform 0.18s;
}

.factionChip::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--chip);
  box-shadow: 0 0 18px var(--chip);
}

.factionChip:hover,
.factionChip.active {
  border-color: var(--chip);
  transform: translateY(-1px);
  color: var(--ink);
}

body.has-filter .factionChip:not(.active) {
  opacity: 0.42;
}

.edge {
  stroke-width: 1.15;
  stroke-opacity: 0.31;
  transition: stroke-opacity 0.22s, stroke-width 0.22s;
}

.routePath {
  fill: none;
  stroke: rgba(240, 195, 90, 0.55);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-dasharray: 8 12;
  filter: drop-shadow(0 0 8px rgba(240, 195, 90, 0.45));
  animation: routeFlow 18s linear infinite;
}

.routeHalo {
  fill: none;
  stroke: rgba(98, 184, 135, 0.16);
  stroke-width: 10;
  stroke-linecap: round;
}

@keyframes routeFlow {
  to {
    stroke-dashoffset: -220;
  }
}

.node {
  cursor: pointer;
  transition: opacity 0.22s;
}

.node circle.core {
  stroke: rgba(255, 255, 255, 0.14);
  stroke-width: 1.2;
  transition: stroke 0.2s, stroke-width 0.2s, filter 0.2s;
}

.node circle.aura {
  fill: none;
  stroke: currentColor;
  stroke-opacity: 0.22;
  stroke-width: 1.1;
  animation: nodePulse 4.8s ease-in-out infinite;
}

@keyframes nodePulse {
  50% {
    transform: scale(1.22);
    stroke-opacity: 0.05;
  }
}

.node text {
  font-family: var(--ui);
  font-size: 11px;
  fill: var(--ink);
  paint-order: stroke;
  stroke: rgba(9, 11, 20, 0.92);
  stroke-width: 5px;
  stroke-linejoin: round;
  text-anchor: middle;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.node.hub text,
.node.kind-place text {
  opacity: 0.82;
}

.node:hover text,
.node.hovered text,
#graphSvg.labels-on .node text,
#graphSvg.focused .node.sel text,
#graphSvg.focused .node.adj text {
  opacity: 1;
}

#graphSvg.focused .node,
body.has-filter .node {
  opacity: 0.14;
}

#graphSvg.focused .node.sel,
#graphSvg.focused .node.adj,
body.has-filter .node.in-filter {
  opacity: 1;
}

#graphSvg.focused .edge,
body.has-filter .edge {
  stroke-opacity: 0.04;
}

#graphSvg.focused .edge.lit,
#graphSvg.hovering .edge.lit {
  stroke-opacity: 0.96;
  stroke-width: 2.1;
}

.node.sel circle.core {
  filter: url(#nodeGlow);
  stroke: var(--gold);
  stroke-width: 2.5;
}

.node.hovered circle.core {
  stroke: var(--gold);
  stroke-width: 2;
}

#focusVeil {
  position: fixed;
  inset: 0;
  z-index: 28;
  opacity: 0;
  pointer-events: none;
  background: rgba(5, 7, 14, 0.12);
  backdrop-filter: blur(0);
  transition: opacity 0.28s, backdrop-filter 0.28s;
}

body.detail-open #focusVeil {
  opacity: 1;
  backdrop-filter: blur(3px);
}

#detailPanel {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 30;
  width: min(410px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 24px 24px 22px;
  border: 1px solid rgba(240, 195, 90, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(34, 30, 25, 0.96), rgba(14, 18, 29, 0.96)),
    rgba(20, 19, 18, 0.94);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transform: translateX(calc(100% + 48px)) scale(0.98);
  opacity: 0;
  transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.32s;
}

body.detail-open #detailPanel {
  transform: translateX(0) scale(1);
  opacity: 1;
}

.closeBtn {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 25px;
  line-height: 1;
}

.detailHero {
  position: relative;
  min-height: 0;
}

.detailIdentity {
  position: relative;
  z-index: 2;
  transition: padding-right 0.22s;
}

.detailHero.hasPortrait {
  min-height: 224px;
}

.detailHero.hasPortrait .detailIdentity {
  padding-right: 160px;
}

.detailSigil {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  color: #15120b;
  background: var(--gold);
  font-family: var(--ui);
  font-weight: 700;
  box-shadow: 0 0 34px rgba(240, 195, 90, 0.35);
}

.detailPortraitStage {
  --portrait-stage-size: 154px;
  --portrait-stage-top: 62px;
  --portrait-frame-stroke: rgba(240, 195, 90, 0.58);

  position: absolute;
  top: var(--portrait-stage-top);
  right: 2px;
  z-index: 1;
  width: var(--portrait-stage-size);
  height: var(--portrait-stage-size);
  overflow: hidden;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0.98;
}

.detailPortraitStage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border: 1px solid var(--portrait-frame-stroke);
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 238, 174, 0.1);
  opacity: 0.82;
  pointer-events: none;
}

.detailPortrait {
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
  display: block;
  object-fit: cover;
  object-position: center top;
  border-radius: inherit;
  opacity: 0.9;
  filter: contrast(1.16) sepia(0.18) saturate(0.9);
  mix-blend-mode: screen;
  -webkit-mask-image: none;
  mask-image: none;
}

.detailPortrait[hidden] {
  display: none;
}

.detailTitle {
  margin-top: 16px;
}

.detailTitle h2 {
  margin: 4px 0 5px;
  font-family: var(--serif);
  font-size: 31px;
  letter-spacing: 0.06em;
  line-height: 1.1;
}

.detailTitle p {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}

.detailTitle span {
  font-size: 12px;
}

.detailBio {
  margin: 18px 0 22px;
  color: rgba(238, 240, 223, 0.86);
  font-size: 14.5px;
  line-height: 1.76;
}

.detailStudy {
  margin: 0 0 22px;
  border: 1px solid rgba(99, 181, 139, 0.25);
  border-radius: 8px;
  padding: 12px;
  background: rgba(99, 181, 139, 0.06);
}

.detailStudy[hidden] {
  display: none;
}

.studyHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-family: var(--ui);
  font-size: 11px;
}

.studyHead span {
  color: var(--jade);
  font-weight: 800;
  letter-spacing: 0.12em;
}

.studyHead strong {
  color: rgba(240, 234, 215, 0.72);
  font-weight: 700;
}

.studyGrid {
  display: grid;
  gap: 8px;
}

.studyGrid section {
  border-radius: 8px;
  padding: 10px;
  background: rgba(8, 11, 20, 0.36);
}

.studyGrid span {
  display: block;
  margin-bottom: 5px;
  color: var(--gold);
  font-family: var(--ui);
  font-size: 11px;
  font-weight: 800;
}

.studyGrid p {
  margin: 0;
  color: rgba(240, 234, 215, 0.84);
  font-size: 13px;
  line-height: 1.62;
}

.relGroup {
  margin-top: 18px;
}

.relTitle {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
  color: var(--muted);
  font-family: var(--ui);
  font-size: 11px;
  letter-spacing: 0.16em;
}

.relTitle::before {
  content: "";
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: var(--rel);
}

.relItem {
  width: 100%;
  min-height: 40px;
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  text-align: left;
  transition: background 0.16s, border-color 0.16s;
}

.relItem:hover {
  border-color: rgba(240, 195, 90, 0.22);
  background: rgba(255, 255, 255, 0.055);
}

.relDot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dot);
  box-shadow: 0 0 14px var(--dot);
}

.relName {
  font-size: 14px;
}

.relLabel {
  max-width: 150px;
  color: var(--muted);
  font-family: var(--ui);
  font-size: 11px;
  text-align: right;
}

.readerView {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  overflow-y: auto;
  padding: 230px 0 68px;
  scroll-padding-top: 230px;
  background:
    linear-gradient(180deg, rgba(14, 18, 29, 0.62), rgba(14, 18, 29, 0.92)),
    rgba(14, 18, 29, 0.72);
  backdrop-filter: blur(7px);
}

body[data-view="timeline"] #timelineView,
body[data-view="artifacts"] #artifactView {
  display: block;
}

body[data-view="timeline"] #stage,
body[data-view="artifacts"] #stage,
body[data-view="timeline"] #legend,
body[data-view="artifacts"] #legend {
  display: none;
}

.readerInner {
  width: min(980px, calc(100vw - 36px));
  margin: 0 auto;
}

.readerHead {
  max-width: 720px;
  margin-bottom: 26px;
}

.eyebrow {
  color: var(--gold) !important;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.readerHead h2 {
  margin: 4px 0 10px;
  font-size: clamp(30px, 5vw, 54px);
  letter-spacing: 0.08em;
}

.readerHead p:last-child {
  font-size: 14px;
  line-height: 1.7;
}

.timelineList {
  position: relative;
  display: grid;
  gap: 12px;
}

.timelineCard,
.artifactCard {
  position: relative;
  border: 1px solid rgba(238, 240, 223, 0.11);
  border-radius: 8px;
  background: rgba(18, 22, 38, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 18px 44px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px) saturate(1.25);
  overflow: hidden;
}

.timelineCard {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 18px;
  padding: 18px;
}

.timelineCard::before,
.artifactCard::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(224, 182, 95, 0.08), transparent 42%, rgba(99, 181, 139, 0.06));
  opacity: 0.8;
}

.timelineEra {
  color: var(--gold);
  font-family: var(--ui);
  font-size: 12px;
  letter-spacing: 0.12em;
}

.timelineCard h3,
.artifactCard h3 {
  margin: 0 0 8px;
  font-size: 21px;
  letter-spacing: 0.04em;
}

.timelineCard p,
.artifactCard p {
  margin: 0;
  color: rgba(238, 240, 223, 0.82);
  font-size: 14px;
  line-height: 1.65;
}

.chipRow {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 13px;
}

.miniChip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  border: 1px solid rgba(238, 240, 223, 0.12);
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(10, 13, 24, 0.48);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--ui);
  font-size: 11px;
  backdrop-filter: blur(8px) saturate(1.4);
}

.miniChip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--chip);
}

.artifactGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.artifactCard {
  min-height: 210px;
  padding: 18px;
  cursor: pointer;
  transition: transform 0.18s, border-color 0.18s;
}

.artifactCard:hover {
  transform: translateY(-2px);
  border-color: rgba(240, 195, 90, 0.34);
}

.artifactType {
  display: inline-flex;
  align-items: center;
  height: 26px;
  margin-bottom: 26px;
  border: 1px solid rgba(240, 195, 90, 0.24);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--gold);
  font-family: var(--ui);
  font-size: 11px;
  letter-spacing: 0.12em;
}

.artifactOwner {
  margin-top: 16px;
}

@media (max-width: 720px) {
  .cornerActions {
    top: 12px;
    right: 12px;
    max-width: calc(100vw - 24px);
    justify-content: flex-end;
  }

  .seriesLink,
  .rewardBtn {
    min-height: 30px;
    padding: 0 11px;
    font-size: 11px;
  }

  .seriesLink {
    max-width: 98px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .rewardModal h2 {
    max-width: 100%;
    font-size: clamp(30px, 8vw, 38px);
    white-space: normal;
  }

  .topbar {
    width: 100%;
    padding: 14px 14px 22px;
  }

  .brand p {
    font-size: 10px;
    letter-spacing: 0.12em;
  }

  .viewnav {
    margin-top: 12px;
  }

  .searchBox {
    width: calc(100vw - 116px);
  }

  .studentMissionDock {
    top: auto;
    right: 10px;
    bottom: 88px;
    left: 10px;
    width: auto;
    padding: 10px;
  }

  .studentMissionDock h2 {
    margin-bottom: 8px;
    font-size: 18px;
  }

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

  .missionCard {
    min-height: 68px;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 4px;
    padding: 8px 6px;
    text-align: center;
  }

  .missionCard span {
    grid-row: auto;
    width: 26px;
    height: 26px;
  }

  .missionCard strong {
    font-size: 11px;
  }

  .missionCard small {
    font-size: 10px;
    line-height: 1.25;
  }

  #legend {
    left: 10px;
    right: 10px;
    bottom: 10px;
    max-width: none;
    max-height: 30vh;
    overflow-y: auto;
  }

  #detailPanel {
    top: auto;
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    max-height: 72vh;
    transform: translateY(calc(100% + 28px)) scale(0.98);
  }

  body.detail-open #detailPanel {
    transform: translateY(0) scale(1);
  }

  .detailHero.hasPortrait {
    min-height: 218px;
  }

  .detailHero.hasPortrait .detailIdentity {
    padding-right: 152px;
  }

  .detailPortraitStage {
    --portrait-stage-size: 152px;
    --portrait-stage-top: 62px;

    right: -12px;
  }

  .readerView {
    padding-top: 194px;
    scroll-padding-top: 194px;
  }

  .timelineCard {
    grid-template-columns: 1fr;
    gap: 9px;
  }
}
