:root {
  color-scheme: dark;
  --bg: #080a10;
  --surface: rgba(17, 18, 25, 0.92);
  --surface-soft: rgba(255, 255, 255, 0.045);
  --line: rgba(255, 255, 255, 0.15);
  --line-strong: rgba(255, 255, 255, 0.3);
  --text: #f4f1ed;
  --soft: rgba(244, 241, 237, 0.65);
  --faint: rgba(244, 241, 237, 0.38);
  --gold: #ffd479;
  --mint: #5eead4;
  --safe-top: max(10px, env(safe-area-inset-top));
  --safe-right: max(14px, env(safe-area-inset-right));
  --safe-bottom: max(12px, env(safe-area-inset-bottom));
  --safe-left: max(14px, env(safe-area-inset-left));
}

* { box-sizing: border-box; }
html, body { min-width: 100%; min-height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font-family: "Noto Serif SC", "Songti SC", "STSong", serif; }
button, a { color: inherit; font: inherit; }

.bond-page {
  min-height: 100vh;
  padding: calc(var(--safe-top) + 58px) var(--safe-right) var(--safe-bottom) var(--safe-left);
  background:
    linear-gradient(rgba(255,255,255,.027) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.027) 1px, transparent 1px),
    radial-gradient(circle at 70% 12%, rgba(83, 105, 149, .2), transparent 36%),
    linear-gradient(130deg, #080a10 0%, #0d101a 55%, #090a10 100%);
  background-size: 74px 74px, 74px 74px, auto, auto;
}

.bond-topbar {
  position: fixed;
  z-index: 20;
  inset: 0 0 auto;
  height: calc(var(--safe-top) + 50px);
  padding: var(--safe-top) var(--safe-right) 0 var(--safe-left);
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, rgba(8, 10, 16, .98), rgba(8, 10, 16, .8));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(8, 8, 12, .7);
  text-decoration: none;
}
.icon-button svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.bond-title { display: flex; align-items: baseline; gap: 12px; }
.bond-title small { color: var(--gold); font: 500 10px/1 "DM Mono", monospace; letter-spacing: 3px; }
.bond-title strong { font-size: 23px; font-weight: 600; }
.bond-count { min-width: 118px; height: 38px; padding: 0 14px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.bond-count span, .bond-count em { color: var(--soft); font-size: 12px; font-style: normal; }
.bond-count strong { color: var(--gold); font: 600 20px/1 "DM Mono", monospace; }

.bond-intro { min-height: 118px; padding: 16px 18px 18px; display: flex; align-items: end; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.bond-intro p { margin: 0 0 8px; color: var(--gold); font: 500 10px/1 "DM Mono", monospace; letter-spacing: 3px; }
.bond-intro h1 { margin: 0 0 7px; font-size: clamp(28px, 3.4vw, 48px); font-weight: 500; }
.bond-intro div > span { color: var(--soft); font-size: 14px; }
.bond-progress { width: min(300px, 30vw); display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; }
.bond-progress > span { height: 3px; overflow: hidden; background: rgba(255,255,255,.1); }
.bond-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--mint)); }
.bond-progress small { color: var(--soft); font: 500 12px/1 "DM Mono", monospace; }

.bond-roster { padding: 14px 2px 30px; display: grid; gap: 22px; }
.bond-world-section { min-width: 0; padding-top: 16px; border-top: 1px solid var(--line); }
.bond-world-section:first-child { padding-top: 0; border-top: 0; }
.bond-world-heading { min-height: 52px; margin-bottom: 10px; display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.bond-world-heading small { display: block; margin-bottom: 5px; color: var(--gold); font: 500 9px/1 "DM Mono", monospace; letter-spacing: 2.4px; }
.bond-world-heading h2 { margin: 0; font-size: 24px; font-weight: 500; }
.bond-world-heading > span { color: var(--faint); font-size: 11px; white-space: nowrap; }
.bond-world-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.bond-card { position: relative; min-width: 0; aspect-ratio: 3 / 4.35; overflow: hidden; display: block; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: #11131a; color: var(--text); text-align: left; text-decoration: none; cursor: pointer; isolation: isolate; }
.bond-card img, .bond-silhouette { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; }
.bond-silhouette { display: grid; place-items: center; background: linear-gradient(145deg, #161822, #090a0f); }
.bond-silhouette::before { content: ""; width: 46%; aspect-ratio: 1; border-radius: 50%; background: rgba(255,255,255,.08); }
.bond-silhouette i { position: absolute; top: 43%; width: 70%; height: 60%; border-radius: 50% 50% 0 0; background: rgba(255,255,255,.065); }
.card-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(7,8,12,.05) 25%, rgba(7,8,12,.45) 57%, rgba(7,8,12,.98) 100%); }
.is-locked img { filter: grayscale(.72) brightness(.46); }
.world-mark, .met-mark { position: absolute; z-index: 2; top: 12px; padding: 5px 8px; border: 1px solid var(--line); background: rgba(7,8,12,.66); font-size: 11px; }
.world-mark { left: 12px; }
.met-mark { right: 12px; color: var(--mint); }
.lock-mark { position: absolute; z-index: 2; top: 42%; left: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); border: 1px solid rgba(255,212,121,.5); border-radius: 50%; background: rgba(8,9,14,.75); }
.lock-mark::before { content: ""; position: absolute; left: 13px; top: 10px; width: 16px; height: 13px; border: 2px solid var(--gold); border-bottom: 0; border-radius: 9px 9px 0 0; }
.lock-mark::after { content: ""; position: absolute; left: 11px; top: 21px; width: 20px; height: 15px; border-radius: 3px; background: var(--gold); }
.card-copy { position: absolute; z-index: 2; right: 14px; bottom: 15px; left: 14px; display: flex; flex-direction: column; gap: 5px; }
.card-copy small { color: var(--gold); font-size: 10px; }
.card-copy strong { font-size: clamp(21px, 2vw, 30px); font-weight: 500; }
.card-copy em { min-height: 2.8em; color: var(--soft); font-size: 12px; line-height: 1.4; font-style: normal; }
.card-arrow { position: absolute; z-index: 2; right: 14px; bottom: 14px; font-size: 22px; opacity: 0; transform: translateX(-8px); transition: .2s ease; }
.bond-card.is-met:hover { border-color: rgba(255,212,121,.75); }
.bond-card.is-met:hover .card-arrow { opacity: 1; transform: none; }

.bond-toast { position: fixed; z-index: 30; right: var(--safe-right); bottom: var(--safe-bottom); min-width: 280px; padding: 13px 16px; display: grid; gap: 3px; border: 1px solid rgba(255,212,121,.5); border-radius: 8px; background: rgba(10,10,15,.96); box-shadow: 0 18px 50px rgba(0,0,0,.45); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.bond-toast.is-visible { opacity: 1; transform: none; }
.bond-toast strong { color: var(--gold); font-size: 14px; }
.bond-toast span { color: var(--soft); font-size: 12px; }

@media (max-width: 1080px) { .bond-world-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 780px) {
  .bond-page { padding-top: calc(var(--safe-top) + 52px); }
  .bond-topbar { height: calc(var(--safe-top) + 46px); }
  .bond-title small { display: none; }
  .bond-title strong { font-size: 20px; }
  .bond-intro { min-height: 94px; padding: 10px 2px 12px; align-items: center; }
  .bond-intro h1 { font-size: 26px; }
  .bond-intro p, .bond-intro div > span { display: none; }
  .bond-progress { width: 34vw; }
  .bond-roster { padding-top: 8px; gap: 16px; }
  .bond-world-heading { min-height: 44px; }
  .bond-world-heading h2 { font-size: 20px; }
  .bond-world-grid { grid-template-columns: repeat(4, minmax(140px, 1fr)); overflow-x: auto; scrollbar-width: none; }
  .bond-world-grid::-webkit-scrollbar { display: none; }
  .bond-card { min-height: 250px; }
}

@media (max-height: 430px) and (orientation: landscape) {
  .bond-intro { min-height: 66px; }
  .bond-intro h1 { margin: 0; font-size: 22px; }
  .bond-world-grid { grid-template-columns: repeat(5, minmax(150px, 1fr)); }
  .bond-card { min-height: 230px; }
  .card-copy { right: 10px; bottom: 10px; left: 10px; }
  .card-copy strong { font-size: 19px; }
  .card-copy em { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }

/* Unified pure-black canvas */
:root { --bg: #000; }
html,
body,
.bond-page,
.bond-topbar {
  background-color: #000;
}
.bond-page,
.bond-topbar {
  background-image: none;
}
