/* 메인 페이지 (기록 보관소) */
body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 70% 30% at 50% 0%, rgba(124,58,237,.16), transparent 70%),
    linear-gradient(rgba(255,255,255,.02) 1px, transparent 1px) 0 0 / 100% 32px,
    var(--bg);
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
html.modal-open { overflow: hidden; }

/* ---------- 상단 ---------- */
.top {
  position: sticky; top: 0; z-index: 50;
  background: rgba(7,9,13,.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.top-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1120px; margin: 0 auto; padding: 12px 16px 8px;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 15px; }
.brand svg { width: 22px; height: 22px; color: var(--iha); }
.lang-select select {
  appearance: none; -webkit-appearance: none;
  padding: 7px 28px 7px 10px;
  font: inherit; font-size: 12.5px; color: var(--text);
  background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238b94a5'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1px solid var(--line-2); border-radius: 6px;
}
.tabs {
  display: flex; gap: 4px;
  max-width: 1120px; margin: 0 auto; padding: 0 12px 8px;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: 0 0 auto; padding: 7px 14px;
  font-size: 13px; color: var(--muted); text-decoration: none;
  border-radius: 99px; border: 1px solid transparent; white-space: nowrap;
}
.tabs a:hover { color: var(--text); }
.tabs a.is-active { color: #f3e8ff; border-color: rgba(192,132,252,.5); background: rgba(124,58,237,.16); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px 40px; }
.eyebrow { font-size: 10.5px; color: var(--iha); }

/* ---------- 01 · 지도 ---------- */
.peninsula { scroll-margin-top: 110px; padding-top: clamp(24px, 5vw, 40px); }
.map-layout {
  display: grid; gap: 18px;
  grid-template-areas: "head" "map" "list";
}
.map-head { grid-area: head; }
.map-head h1 { margin: 8px 0 0; font-size: clamp(26px, 6.5vw, 40px); font-weight: 900; }
.map-intro { margin: 10px 0 0; font-size: 14px; line-height: 1.75; color: #aab2c0; max-width: 460px; }

.map-wrap {
  grid-area: map; position: relative;
  border: 1px solid var(--line); border-radius: 16px;
  background:
    radial-gradient(ellipse 60% 40% at 45% 45%, rgba(61,107,179,.14), transparent 70%),
    linear-gradient(rgba(138,180,238,.04) 1px, transparent 1px) 0 0 / 100% 40px,
    linear-gradient(90deg, rgba(138,180,238,.04) 1px, transparent 1px) 0 0 / 40px 100%,
    #090c12;
  padding: 10px 8px 34px;
  overflow: hidden;
}
.map { display: block; width: 100%; height: auto; max-height: calc(100svh - 200px); margin: 0 auto; overflow: visible; }
.map-hint {
  position: absolute; left: 0; right: 0; bottom: 10px;
  text-align: center; font-size: 11.5px; color: var(--muted);
}
.map-hint .mono { font-size: 9.5px; color: var(--gate); margin-right: 4px; }

/* 지도 도형 (한반도·세계 공용) */
.map .nb { fill: #121722; stroke: #1c2330; stroke-width: 1; vector-effect: non-scaling-stroke; }
.imap .hit { fill: transparent; stroke: none; cursor: pointer; outline: none; pointer-events: all; }
.imap .hit:focus-visible { stroke: #fff; stroke-width: 2; vector-effect: non-scaling-stroke; }
.imap .prov { pointer-events: none; transition: transform .45s cubic-bezier(.34,1.56,.64,1), opacity .3s ease; }
.imap .prov path {
  fill: var(--c); fill-opacity: .26;
  stroke: var(--c); stroke-opacity: .85; stroke-width: 1.2; stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  transition: fill-opacity .3s ease, stroke-width .3s;
}
.imap.has-hover .prov { opacity: .25; }
.imap .prov.is-hover { opacity: 1; transform: translateY(var(--lift)); filter: var(--filter); }
.imap .prov.is-hover path { fill-opacity: .55; stroke-width: 2.2; stroke-opacity: 1; }

.imap .labels text {
  font-family: var(--font); font-weight: 800; font-size: 34px;
  fill: #eef1f6; text-anchor: middle; dominant-baseline: middle;
  paint-order: stroke; stroke: rgba(7,9,13,.88); stroke-width: 8px; stroke-linejoin: round;
  pointer-events: none;
  transition: opacity .3s, transform .45s cubic-bezier(.34,1.56,.64,1);
}
.imap .labels text.sub { font-size: 21px; font-weight: 500; fill: #a8b1c0; }
.imap.has-hover .labels [data-id] { opacity: .25; }
.imap.has-hover .labels .is-hover { opacity: 1; transform: translateY(var(--lift)); }

/* 도 목록 (지도 옆/아래) + 길드 엠블럼 */
.prov-list { grid-area: list; display: grid; grid-template-columns: 1fr; gap: 8px; align-content: start; }
.prov-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 84px; text-align: left;
  padding: 12px 12px 12px 16px;
  border: 1px solid var(--line); border-left: 3px solid var(--c);
  border-radius: 10px; background: rgba(15,19,27,.8);
  transition: background .2s, border-color .2s;
}
.prov-btn:hover, .prov-btn.is-hover { background: color-mix(in srgb, var(--c) 12%, #0f131b); border-color: color-mix(in srgb, var(--c) 45%, transparent); border-left-color: var(--c); }
.pb-text { flex: 1; min-width: 0; }
.pb-text b { display: block; font-size: 15px; color: var(--text); }
.pb-text small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.pb-embs { display: flex; gap: 10px; flex: 0 0 auto; }
.pb-emb { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 58px; }
.pb-emb .emb { width: 46px; height: 46px; }
.pb-name { font-size: 10.5px; font-weight: 700; line-height: 1.25; text-align: center; word-break: keep-all; }

/* 엠블럼: 정사각형 틀 안에 잘리지 않게(contain) */
.emb {
  position: relative; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 10px; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--c) 18%, #111722), #0b0f16);
  border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
}
.emb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.emb i { display: none; font-style: normal; font-weight: 800; font-size: 18px; color: var(--c); }
.emb.no-img i { display: block; }

@media (min-width: 1100px) { .prov-list { grid-template-columns: 1fr 1fr; } .pb-emb { width: 50px; } .pb-emb .emb { width: 40px; height: 40px; } .prov-btn { padding-left: 13px; gap: 8px; } }
@media (min-width: 900px) {
  .map-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    grid-template-areas: "head map" "list map";
    grid-template-rows: auto 1fr;
    column-gap: 40px;
    align-items: start;
  }
  .map-wrap { position: sticky; top: 118px; }
  .map-head { padding-top: 24px; }
}

/* ---------- 준비 중 섹션 ---------- */
.panel {
  scroll-margin-top: 110px;
  margin-top: 28px;
  padding: clamp(20px, 4vw, 32px);
  border: 1px solid var(--line); border-radius: 12px;
  background: linear-gradient(180deg, rgba(20,26,36,.7), rgba(12,15,21,.7));
}
.panel h2 { margin: 6px 0 0; font-size: clamp(20px, 5vw, 26px); font-weight: 800; }
.todo { margin: 14px 0 0; font-size: 13px; color: var(--dim); }

.foot {
  max-width: 1120px; margin: 0 auto; padding: 24px 16px calc(80px + env(safe-area-inset-bottom));
  display: grid; gap: 12px; justify-items: center; text-align: center;
  font-size: 10px; color: var(--dim);
}
.foot a { font-size: 13px; color: var(--iha); }

/* =========================================================
   모달 (스프링처럼 열리고, 배경은 흐려짐)
   ========================================================= */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .3s ease;
}
.modal-dialog {
  position: relative; width: 100%; max-width: 940px;
  max-height: min(88svh, 920px); overflow-y: auto; overscroll-behavior: contain;
  background: #0c1017; border: 1px solid var(--line-2); border-radius: 16px;
  box-shadow: 0 40px 100px rgba(0,0,0,.6);
  opacity: 0; transform: translateY(24px) scale(.96);
  transition: transform .5s cubic-bezier(.32,1.45,.6,1), opacity .25s ease;
  outline: none;
}
.modal.is-open .modal-backdrop { opacity: 1; }
.modal.is-open .modal-dialog { opacity: 1; transform: none; }
.modal.is-closing .modal-backdrop { opacity: 0; }
.modal.is-closing .modal-dialog { opacity: 0; transform: translateY(12px) scale(.98); transition-duration: .22s; }

.modal-close {
  position: sticky; top: 12px; float: right; z-index: 3;
  margin: 12px 12px 0 0;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line-2); background: rgba(7,9,13,.75);
  font-size: 20px; line-height: 1; color: var(--muted);
  backdrop-filter: blur(4px);
}
.modal-close:hover { color: var(--text); border-color: rgba(255,255,255,.35); }

@media (max-width: 640px) { /* 휴대폰: 아래에서 올라오는 시트 */
  .modal { align-items: flex-end; padding: 0; }
  .modal-dialog { max-height: 92svh; border-radius: 18px 18px 0 0; border-bottom: 0; transform: translateY(48px); }
  .modal.is-closing .modal-dialog { transform: translateY(32px); }
  .modal-dialog::before { content: ""; display: block; width: 40px; height: 4px; margin: 8px auto 0; border-radius: 4px; background: rgba(255,255,255,.18); }
}

/* 모달 내용 */
.m-head {
  padding: 28px clamp(18px, 4vw, 32px) 22px;
  background: radial-gradient(ellipse 80% 120% at 0% 0%, color-mix(in srgb, var(--c) 22%, transparent), transparent 70%);
  border-bottom: 1px solid var(--line);
}
.m-eyebrow { font-size: 10px; color: var(--c); }
.m-head h2 { margin: 6px 0 0; font-size: clamp(26px, 6vw, 34px); font-weight: 900; }
.m-cities { margin-top: 6px; font-size: 13px; color: var(--muted); }
.m-cities b { color: var(--c); font-weight: 600; }
.m-desc { margin: 12px 0 0; font-size: 14px; line-height: 1.75; color: #c2c8d3; max-width: 640px; }

.m-sec { padding: 22px clamp(18px, 4vw, 32px) 4px; }
.m-sec h3 { margin: 0 0 12px; display: flex; align-items: baseline; gap: 8px; font-size: 15px; font-weight: 800; }
.m-sec h3 small { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; color: var(--dim); font-weight: 400; }

.g-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.g-card {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 16px; border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 10%, transparent), transparent 70%), #0f131b;
}
.g-card.is-market { border-style: dashed; }
.g-card .emb { width: 56px; height: 56px; }
.g-info { flex: 1; min-width: 0; }
.g-top { display: flex; justify-content: space-between; gap: 8px; font-size: 10px; }
.g-type { color: var(--c); letter-spacing: .14em; }
.g-rival { color: #fca5a5; font-weight: 600; }
.g-name { margin-top: 6px; font-size: 18px; font-weight: 800; color: var(--c); }
.g-spec { margin-top: 2px; font-size: 12.5px; color: #c2c8d3; line-height: 1.6; }
.g-meta { margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.g-meta b { color: var(--text); font-weight: 600; }

.p-group { display: flex; align-items: center; gap: 8px; margin: 18px 0 10px; font-size: 13px; font-weight: 700; }
.p-group:first-of-type { margin-top: 0; }
.p-group::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--c); }
.p-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(46%, 168px), 1fr)); gap: 12px; }

.p-card {
  display: flex; flex-direction: column;
  border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: #0f131b;
  transition: transform .25s ease, border-color .25s;
}
.p-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--c) 45%, transparent); }
.p-img { position: relative; background: #141924; }
.p-img img { display: block; width: 100%; height: auto; } /* 원본 비율 그대로, 잘리지 않음 */
.p-mono {
  aspect-ratio: 3 / 4; display: grid; place-items: center;
  font: 700 clamp(26px, 7vw, 38px) var(--mono); color: color-mix(in srgb, var(--c) 55%, transparent);
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 14%, #10141c), #0b0e14);
}
.p-grade {
  position: absolute; left: 8px; top: 8px;
  min-width: 26px; height: 26px; padding: 0 6px;
  display: grid; place-items: center;
  font: 800 13px var(--mono); border-radius: 6px;
  background: rgba(7,9,13,.78); border: 1px solid currentColor;
}
.p-grade.is-none { font-size: 10px; font-family: var(--font); font-weight: 600; }
.g-S { color: #c084fc; } .g-A { color: #f87171; } .g-B { color: #fb923c; }
.g-C { color: #a78bfa; } .g-D { color: #60a5fa; } .g-E { color: #4ade80; } .g-F { color: #9ca3af; } .g-none { color: #8b94a5; }

.p-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.p-name { font-size: 15px; font-weight: 800; line-height: 1.3; }
.p-sub { font-size: 10.5px; color: var(--dim); }
.p-meta { margin-top: 4px; font-size: 11px; color: var(--muted); }
.p-role { font-size: 11.5px; color: var(--c); font-weight: 600; line-height: 1.45; }
.p-dl { margin: 8px 0 0; font-size: 11.5px; line-height: 1.45; }
.p-dl dt { margin-top: 6px; font-size: 10px; color: var(--dim); }
.p-dl dt:first-child { margin-top: 0; }
.p-dl dd { margin: 1px 0 0; color: #c9cfd9; }
.p-abil { display: inline-block; padding: 0 5px; margin-right: 3px; border-radius: 3px; font-size: 10px; color: var(--iha); border: 1px solid rgba(138,180,238,.35); }

.m-note { margin: 20px clamp(18px, 4vw, 32px) 26px; font-size: 11.5px; color: var(--dim); }

/* =========================================================
   화면 전환
   ========================================================= */
.view { padding-top: clamp(24px, 5vw, 40px); }
.view.is-enter { animation: viewIn .5s ease both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.view-head { margin-bottom: 20px; }
.view-head h1 { margin: 8px 0 0; font-size: clamp(26px, 6.5vw, 40px); font-weight: 900; }
.view-intro { margin: 10px 0 0; font-size: 14px; line-height: 1.75; color: #aab2c0; max-width: 640px; }
.sec-note { margin: 14px 0 0; font-size: 12px; line-height: 1.7; color: var(--dim); }

.next-view {
  display: flex; align-items: center; gap: 12px; margin-top: 40px;
  padding: 18px 20px; border-radius: 12px; text-decoration: none;
  border: 1px solid var(--line); background: linear-gradient(90deg, rgba(124,58,237,.12), transparent 70%), #0d1118;
  transition: border-color .2s, background .2s;
}
.next-view:hover { border-color: rgba(192,132,252,.45); }
.next-view small { font-size: 11px; color: var(--muted); }
.next-view b { flex: 1; font-size: 16px; color: var(--text); }
.next-view span { font-size: 20px; color: var(--gate); }

/* =========================================================
   화면 2 · 해외 영토 수복
   ========================================================= */
.wmap-wrap {
  position: relative; border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  background: radial-gradient(ellipse 50% 60% at 50% 50%, rgba(61,107,179,.12), transparent 70%), #080b11;
  padding: 10px 8px 34px;
}
.wmap { display: block; width: 100%; height: auto; overflow: visible; }
.wmap .w-sphere { fill: #0b1019; stroke: #1b2331; stroke-width: 1; vector-effect: non-scaling-stroke; }
.wmap .w-grat { fill: none; stroke: #172030; stroke-width: .8; vector-effect: non-scaling-stroke; }
.wmap .prov path { fill-opacity: .18; stroke-width: 1; }
.wmap .prov path.dots { fill: url(#wdots); fill-opacity: .55; stroke: none; mix-blend-mode: overlay; }
.wmap .prov.is-hover path { fill-opacity: .5; }
.wmap .prov.is-hover path.dots { fill-opacity: .9; }
.wmap .labels text { font-size: 15px; stroke-width: 4px; }
.wmap .labels text.sub { font-size: 11px; font-family: var(--mono); letter-spacing: .1em; fill: #fca5a5; font-weight: 700; }
.wmap .w-label { transition: opacity .3s, transform .45s cubic-bezier(.34,1.56,.64,1); }
.wmap .safe .kr { fill: #e9d5ff; stroke: #fff; stroke-width: .6; filter: drop-shadow(0 0 4px #c084fc); }
.wmap .safe .pulse { fill: none; stroke: #c084fc; stroke-width: 1.2; transform-origin: center; transform-box: fill-box; animation: safePulse 2.4s ease-out infinite; }
.wmap .safe .pulse.p2 { animation-delay: 1.2s; }
@keyframes safePulse { from { transform: scale(.6); opacity: .9; } to { transform: scale(3.4); opacity: 0; } }
.wmap .labels .safe-t { font-family: var(--mono); font-size: 9px; letter-spacing: .14em; fill: #e9d5ff; stroke-width: 3px; text-anchor: start; font-weight: 700; }
.wmap.has-hover .safe { opacity: .5; }

.cont-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
@media (min-width: 760px) { .cont-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .cont-list { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.cont-btn {
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left;
  padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line); border-top: 2px solid var(--c); background: rgba(15,19,27,.8);
  transition: background .2s, border-color .2s;
}
.cont-btn:hover, .cont-btn.is-hover { background: color-mix(in srgb, var(--c) 12%, #0f131b); border-color: color-mix(in srgb, var(--c) 45%, transparent); border-top-color: var(--c); }
.cont-btn b { font-size: 14px; color: var(--text); }
.cb-grade { font: 700 12px var(--mono); letter-spacing: .06em; }
.cb-grade i, .c-grade i { font-style: normal; color: var(--dim); margin: 0 2px; }

.steps-box { margin-top: 28px; padding: clamp(18px, 4vw, 26px); border: 1px solid var(--line); border-radius: 12px; background: #0d1118; }
.steps-box h3 { margin: 0 0 14px; font-size: 15px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; counter-reset: s; }
@media (min-width: 760px) { .steps { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.steps li {
  position: relative; padding: 10px 10px 12px; border-radius: 8px;
  background: linear-gradient(180deg, rgba(138,180,238,.08), transparent); border: 1px solid rgba(138,180,238,.15);
}
.steps li span { display: block; font-size: 10px; color: var(--iha); }
.steps li b { display: block; margin-top: 4px; font-size: 12.5px; line-height: 1.35; }

/* 대륙 모달: 위 이미지 → 검정으로 자연스럽게 사라짐 */
.modal-dialog.is-continent { background: #000; max-width: 760px; }
.c-hero { position: relative; background: #000; }
.c-hero img {
  display: block; width: 100%; height: auto;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 50%, rgba(0,0,0,.6) 72%, transparent 100%);
          mask-image: linear-gradient(180deg, #000 0%, #000 50%, rgba(0,0,0,.6) 72%, transparent 100%);
}
.c-hero.no-img { aspect-ratio: 16 / 7; background: radial-gradient(ellipse 60% 70% at 50% 40%, color-mix(in srgb, var(--c) 30%, transparent), #000 75%); }
.c-body { position: relative; margin-top: -56px; padding: 0 clamp(18px, 5vw, 36px) 8px; }
.c-body h2 { margin: 6px 0 0; font-size: clamp(28px, 7vw, 40px); font-weight: 900; text-shadow: 0 4px 20px #000; }
.c-body h2 small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.c-diff { display: inline-flex; align-items: center; gap: 12px; margin-top: 12px; padding: 8px 14px; border-radius: 8px; border: 1px solid rgba(248,113,113,.35); background: rgba(248,113,113,.08); font-size: 12px; color: #fca5a5; }
.c-grade { font: 800 20px var(--mono); }
.c-desc { margin: 16px 0 0; font-size: 14.5px; line-height: 1.85; color: #d1d6df; }
.c-facts { margin: 18px 0 0; display: grid; gap: 10px; }
.c-facts > div { padding: 12px 14px; border-radius: 10px; background: rgba(255,255,255,.035); border-left: 2px solid var(--c); }
.c-facts dt { font-size: 11px; font-weight: 700; color: var(--c); }
.c-facts dd { margin: 4px 0 0; font-size: 13px; line-height: 1.7; color: #c2c8d3; }
.modal-dialog.is-continent .m-note { margin-left: 0; margin-right: 0; }

/* =========================================================
   화면 3 · 게이트 · 각성
   ========================================================= */
.sub-sec { margin-top: 44px; }
.sub-sec:first-of-type { margin-top: 8px; }
.sub-head { margin-bottom: 16px; }
.sub-head .mono { font-size: 10px; color: var(--gate); }
.sub-head h2 { margin: 6px 0 0; font-size: clamp(21px, 5.2vw, 28px); font-weight: 900; }
.sub-head p { margin: 8px 0 0; font-size: 13.5px; line-height: 1.75; color: #aab2c0; max-width: 680px; }

.sq-img { position: relative; aspect-ratio: 1 / 1; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--c) 20%, #0f141d), #090c12 72%); }
.sq-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sq-fallback { display: none; font: 900 clamp(34px, 9vw, 54px) var(--mono); color: var(--c); text-shadow: 0 0 24px var(--c); }
.sq-img.no-img .sq-fallback { display: block; }

.gate-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(46%, 170px), 1fr)); gap: 12px; }
.gate-card { border-radius: 12px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); background: #0e1219; transition: transform .25s, box-shadow .25s; }
.gate-card:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(0,0,0,.45), 0 0 0 1px var(--c); }
.gate-card .sq-img { border-bottom: 1px solid color-mix(in srgb, var(--c) 25%, transparent); }
.gate-card.is-s { background: linear-gradient(180deg, #120a1c, #0b0812); }
.gate-card.is-s .sq-img::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle, rgba(192,132,252,.25), transparent 60%); animation: ember 3s ease-in-out infinite; pointer-events: none; }
@keyframes ember { 0%, 100% { opacity: .35; } 50% { opacity: .9; } }
.gate-body { padding: 12px 14px 14px; }
.gate-top { display: flex; align-items: baseline; gap: 8px; }
.gate-g { font: 900 24px var(--mono); color: var(--c); text-shadow: 0 0 14px color-mix(in srgb, var(--c) 60%, transparent); }
.gate-name { font-size: 13px; font-weight: 700; color: var(--text); }
.gate-tag { margin-top: 2px; font-size: 11.5px; color: var(--c); font-weight: 600; }
.gate-body p { margin: 8px 0 0; font-size: 12px; line-height: 1.65; color: #b6bdc9; }

.fact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-top: 14px; }
.fact { padding: 14px 16px; border-radius: 10px; border: 1px solid var(--line); background: #0d1118; }
.fact b { font-size: 13px; color: var(--iha); }
.fact p { margin: 6px 0 0; font-size: 12.5px; line-height: 1.7; color: #b6bdc9; }

.def-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.def { padding: 16px; border-radius: 12px; border: 1px solid var(--line); background: linear-gradient(160deg, rgba(138,180,238,.08), transparent 60%), #0d1118; }
.def .mono { font-size: 10px; color: var(--iha); }
.def b { display: block; margin-top: 6px; font-size: 17px; }
.def p { margin: 6px 0 0; font-size: 12.5px; line-height: 1.7; color: #b6bdc9; }
.aw-facts { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.aw-facts li { position: relative; padding-left: 18px; font-size: 13px; line-height: 1.7; color: #c2c8d3; }
.aw-facts li::before { content: "◆"; position: absolute; left: 0; top: 1px; font-size: 9px; color: var(--gate); }

.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 12px; }
.type-card { display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); background: #0e1219; }
.type-emb { border-bottom: 1px solid color-mix(in srgb, var(--c) 25%, transparent); }
.type-body { padding: 14px 16px 16px; }
.type-en { font-size: 10px; color: var(--c); }
.type-body h3 { margin: 4px 0 0; font-size: 19px; font-weight: 900; }
.type-body p { margin: 8px 0 0; font-size: 12.5px; line-height: 1.7; color: #b6bdc9; }
.type-ex { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.type-ex small { width: 100%; font-size: 10.5px; color: var(--dim); }
.chip { padding: 4px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; color: var(--text); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); background: color-mix(in srgb, var(--c) 9%, transparent); }
.chip i { font-style: normal; font-weight: 400; color: var(--muted); }

/* 각성자 분포 차트 */
.dist {
  display: grid; gap: 24px; align-items: center;
  padding: clamp(18px, 4vw, 30px); border-radius: 16px;
  border: 1px solid var(--line);
  background: radial-gradient(ellipse 50% 70% at 20% 50%, rgba(124,58,237,.14), transparent 70%), #0b0e15;
}
@media (min-width: 820px) { .dist { grid-template-columns: 280px 1fr; gap: 36px; } }
.dist-ring { position: relative; width: min(260px, 72vw); margin: 0 auto; aspect-ratio: 1; }
.dist-ring svg { width: 100%; height: 100%; overflow: visible; }
.ring-bg { fill: none; stroke: rgba(255,255,255,.05); stroke-width: 22; }
.ring-seg { fill: none; stroke-width: 22; cursor: pointer; transition: stroke-dasharray 1.3s cubic-bezier(.3,.8,.3,1), stroke-width .25s, opacity .25s; }
.dist.has-focus .ring-seg { opacity: .25; }
.dist.has-focus .ring-seg.is-focus { opacity: 1; stroke-width: 30; }
.ring-seg[data-g="S"], .ring-seg[data-g="A"] { filter: drop-shadow(0 0 6px currentColor); }
.dist-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.dist-center small { font-size: 10px; color: var(--muted); }
.dist-center b { display: block; font: 900 clamp(26px, 7vw, 34px) var(--mono); line-height: 1.15; }
.dist-center span { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); }

.dist-bars { display: grid; gap: 10px; }
.dist-row { display: grid; grid-template-columns: 30px 1fr auto; grid-template-areas: "g track num" "g rar rar"; column-gap: 12px; row-gap: 2px; align-items: center; cursor: default; transition: opacity .25s; }
.dist.has-focus .dist-row { opacity: .35; }
.dist.has-focus .dist-row.is-focus { opacity: 1; }
.dr-g { grid-area: g; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; font: 900 15px var(--mono); color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 50%, transparent); background: color-mix(in srgb, var(--c) 10%, transparent); }
.dr-track { grid-area: track; position: relative; height: 10px; border-radius: 10px; background: rgba(255,255,255,.06); overflow: hidden; }
.dr-track i {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 10px; overflow: hidden;
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 55%, transparent), var(--c));
  box-shadow: 0 0 12px color-mix(in srgb, var(--c) 60%, transparent);
  transition: width 1.4s cubic-bezier(.3,.8,.3,1) var(--d);
}
.dist.is-in .dr-track i { width: var(--w); }
.dr-track i::after { /* 반짝이는 빛 */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  transform: translateX(-100%); animation: shimmer 2.8s ease-in-out infinite; animation-delay: calc(var(--d) + 1.4s);
}
@keyframes shimmer { 0% { transform: translateX(-100%); } 60%, 100% { transform: translateX(200%); } }
.dr-num { grid-area: num; display: flex; align-items: baseline; gap: 6px; min-width: 92px; justify-content: flex-end; }
.dr-num b { font: 800 15px var(--mono); color: var(--text); }
.dr-num small { font: 600 11px var(--mono); color: var(--c); }
.dr-rar { grid-area: rar; font-size: 11px; color: var(--muted); }
.dist-row.is-s .dr-g { animation: sGlow 2s ease-in-out infinite; }
.dist-row.is-s .dr-track i { min-width: 6px; }
@keyframes sGlow { 0%, 100% { box-shadow: 0 0 0 rgba(192,132,252,0); } 50% { box-shadow: 0 0 16px rgba(192,132,252,.8); } }

/* 재각성 소문 (기밀 문서 느낌) */
.rumor {
  position: relative; margin-top: 44px; padding: 22px clamp(18px, 4vw, 28px);
  border: 1px dashed rgba(192,132,252,.5); border-radius: 12px; overflow: hidden;
  background: repeating-linear-gradient(-45deg, rgba(192,132,252,.04) 0 10px, transparent 10px 20px), #0c0912;
}
.rumor-tag { font-size: 10px; color: var(--gate); }
.rumor h3 { position: relative; display: inline-block; margin: 8px 0 0; font-size: 24px; font-weight: 900; }
.rumor h3::before, .rumor h3::after { content: attr(data-text); position: absolute; left: 0; top: 0; width: 100%; overflow: hidden; }
.rumor h3::before { color: #f472b6; animation: glitchA 3.2s steps(1) infinite; }
.rumor h3::after { color: #22d3ee; animation: glitchB 3.2s steps(1) infinite; }
@keyframes glitchA { 0%, 90%, 100% { transform: none; clip-path: inset(0 0 100% 0); } 92% { transform: translate(-2px, 1px); clip-path: inset(10% 0 55% 0); } 95% { transform: translate(2px, -1px); clip-path: inset(60% 0 5% 0); } }
@keyframes glitchB { 0%, 90%, 100% { transform: none; clip-path: inset(0 0 100% 0); } 93% { transform: translate(2px, 0); clip-path: inset(40% 0 30% 0); } 96% { transform: translate(-2px, 1px); clip-path: inset(5% 0 75% 0); } }
.rumor p { margin: 10px 0 0; font-size: 13.5px; line-height: 1.8; color: #c9c2d6; max-width: 620px; }
.redact { display: grid; gap: 6px; margin-top: 14px; max-width: 420px; }
.redact i { display: block; height: 9px; border-radius: 2px; background: #1e1630; }
.redact i:nth-child(1) { width: 92%; } .redact i:nth-child(2) { width: 70%; } .redact i:nth-child(3) { width: 48%; }

/* 게이트 7등급: PC는 한 줄, 휴대폰은 S등급을 넓은 카드로 */
@media (min-width: 1000px) { .gate-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
@media (max-width: 999px) {
  .gate-card.is-s { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
  .gate-card.is-s .sq-img { border-bottom: 0; border-right: 1px solid color-mix(in srgb, var(--c) 25%, transparent); }
  .gate-card.is-s .gate-body { align-self: center; }
}

/* =========================================================
   게이트·각성 화면 오른쪽 고정 바로가기
   ========================================================= */
.sec-nav {
  position: fixed; z-index: 60; right: 18px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 8px; border-radius: 16px;
  background: rgba(10,13,19,.72); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
  animation: snIn .4s ease both;
}
@keyframes snIn { from { opacity: 0; transform: translate(10px, -50%); } to { opacity: 1; transform: translateY(-50%); } }
.sn-line { position: absolute; right: 22px; top: 26px; bottom: 26px; width: 1px; background: linear-gradient(180deg, transparent, rgba(192,132,252,.35), transparent); }
.sec-nav button {
  position: relative; display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 6px 4px 6px 10px; border: 0; border-radius: 10px; background: none;
  color: var(--muted); text-align: right;
  transition: color .2s, background .2s;
}
.sec-nav button:hover { color: var(--text); background: rgba(255,255,255,.04); }
.sn-label { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.sn-dot {
  position: relative; flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,.14); background: #0d1118;
  transition: border-color .25s, box-shadow .25s, background .25s;
}
.sn-dot i { font: 700 9.5px var(--mono); font-style: normal; color: var(--dim); letter-spacing: 0; transition: color .25s; }
.sec-nav button.is-active { color: #f3e8ff; }
.sec-nav button.is-active .sn-dot { border-color: var(--gate); background: rgba(124,58,237,.25); box-shadow: 0 0 0 4px rgba(192,132,252,.12), 0 0 16px rgba(192,132,252,.45); }
.sec-nav button.is-active .sn-dot i { color: #f3e8ff; }

/* 화면이 좁으면 번호 점만 보이고, 현재 위치의 이름만 옆에 표시 */
@media (max-width: 1279px) {
  .sec-nav { right: 8px; padding: 8px 5px; gap: 2px; }
  .sec-nav .sn-label {
    position: absolute; right: calc(100% + 6px); top: 50%; transform: translateY(-50%);
    padding: 4px 9px; border-radius: 99px; font-size: 11.5px;
    background: rgba(10,13,19,.9); border: 1px solid rgba(192,132,252,.4);
    opacity: 0; pointer-events: none; transition: opacity .25s;
  }
  .sec-nav.is-moving button.is-active .sn-label, .sec-nav button:hover .sn-label, .sec-nav button:focus-visible .sn-label { opacity: 1; }
  .sec-nav button { padding: 4px; }
  .sn-line { right: 18px; }
  .sn-dot { width: 26px; height: 26px; }
}
@media (max-width: 640px) {
  .sec-nav { right: 6px; }
  .sn-dot { width: 24px; height: 24px; }
  .sn-dot i { font-size: 8.5px; }
}

/* 휴대폰: 능력 계열 카드를 가로형으로 (엠블럼 왼쪽) */
@media (max-width: 640px) {
  .type-card { flex-direction: row; }
  .type-emb { flex: 0 0 104px; width: 104px; align-self: stretch; aspect-ratio: auto; border-bottom: 0; border-right: 1px solid color-mix(in srgb, var(--c) 25%, transparent); }
  .type-body { padding: 12px 14px 14px; }
  .type-body h3 { font-size: 17px; }
}

/* =========================================================
   인물 카드 클릭 → 확대 모달
   ========================================================= */
.m-hint { margin-left: 4px; font-size: 11.5px; font-weight: 500; color: var(--dim); }
.p-card.is-zoom { cursor: zoom-in; outline: none; }
.p-card.is-zoom:focus-visible { border-color: var(--c); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 40%, transparent); }
.p-zoom {
  position: absolute; right: 8px; top: 8px; width: 26px; height: 26px; border-radius: 6px;
  background: rgba(7,9,13,.7) no-repeat center / 14px
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e6e9ef' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7'/%3E%3C/svg%3E");
  border: 1px solid rgba(255,255,255,.18);
  opacity: .75; transition: opacity .2s, transform .2s;
}
.p-card.is-zoom:hover .p-zoom { opacity: 1; transform: scale(1.08); }

.modal-person { z-index: 110; }
.modal-person .modal-backdrop { background: rgba(0,0,0,.72); }
.modal-person .modal-dialog { max-width: 880px; background: #0c1017; }
.modal-person .modal-body { padding: 0; }
.modal-person .modal-close { float: none; display: block; margin: 12px 12px -48px auto; }
.p-card.is-big {
  flex-direction: row; border: 0; border-radius: 0; background: transparent;
}
.p-card.is-big:hover { transform: none; }
.p-card.is-big .p-img { flex: 0 0 48%; align-self: flex-start; background: #0a0d13; }
.p-card.is-big .p-img img { max-height: min(84svh, 860px); width: 100%; object-fit: contain; }
.p-card.is-big .p-mono { font-size: 64px; }
.p-card.is-big .p-grade { left: 14px; top: 14px; min-width: 38px; height: 38px; font-size: 18px; border-radius: 8px; }
.p-card.is-big .p-grade.is-none { font-size: 13px; }
.p-card.is-big .p-body { flex: 1; padding: 34px 30px 28px; gap: 4px; border-top: 3px solid var(--c); }
.p-card.is-big .p-name { font-size: 28px; }
.p-card.is-big .p-sub { font-size: 13px; }
.p-card.is-big .p-meta { margin-top: 10px; font-size: 14px; }
.p-card.is-big .p-role { font-size: 15.5px; }
.p-card.is-big .p-dl { margin-top: 18px; font-size: 15px; line-height: 1.6; }
.p-card.is-big .p-dl dt { margin-top: 14px; font-size: 12px; letter-spacing: .04em; }
.p-card.is-big .p-dl dt:first-child { margin-top: 0; }
.p-card.is-big .p-abil { font-size: 12px; padding: 1px 7px; margin-right: 6px; }
.p-card.is-swap { animation: pvSwap .35s ease; }
@keyframes pvSwap { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }

.pv-nav {
  position: sticky; bottom: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center; gap: 18px;
  padding: 10px; background: linear-gradient(transparent, rgba(12,16,23,.95) 40%);
}
.pv-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line-2); background: rgba(7,9,13,.8);
  font-size: 24px; line-height: 1; color: var(--text);
}
.pv-btn:hover { border-color: rgba(255,255,255,.4); }
.pv-count { font-size: 12px; color: var(--muted); min-width: 52px; text-align: center; }

@media (max-width: 640px) {
  .p-card.is-big { flex-direction: column; }
  .p-card.is-big .p-img { flex: none; width: 100%; }
  .p-card.is-big .p-img img { max-height: none; }
  .p-card.is-big .p-body { padding: 20px 20px 18px; border-top-width: 3px; }
  .p-card.is-big .p-name { font-size: 24px; }
  .m-hint { display: block; margin: 4px 0 0; }
}
