/* 「국가권역 독식」 협회 기록 열람 단말 */
:root {
  color-scheme: dark;
  --bg: #0A0C10;
  --panel: #11151C;
  --panel-2: #151A23;
  --line: #232B38;
  --text: #E6EAF0;
  --sub: #8A94A6;
  --rift: #4FD8FF;
  --alert: #FF4D5E;
  --measure: #FFFFFF;

  --g-E: #9AA3B2;
  --g-D: #2DD4BF;
  --g-C: #4ADE80;
  --g-B: #60A5FA;
  --g-A: #B794F6;
  --g-S: #FF9F43;
  --g-RIFT: #4FD8FF;
  --g-NATION: #FF4D5E;
  --g-UNK: #FFFFFF;

  --font: "Noto Sans KR", system-ui, -apple-system, "Malgun Gothic", sans-serif;
  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --radius: 4px;
  --top-h: 56px;
  --rail-h: 38px;
  --gutter: max(32px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top-h) + var(--rail-h) + 16px + env(safe-area-inset-top, 0px)); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image:
    linear-gradient(rgba(79, 216, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 216, 255, .025) 1px, transparent 1px);
  background-size: 48px 48px;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 700; }
p { margin: 0; }
ul, ol, dl { margin: 0; padding: 0; }
.mono { font-family: var(--mono); letter-spacing: .04em; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--rift); outline-offset: 2px; }
.skip {
  position: absolute; left: 8px; top: -48px; z-index: 100;
  background: var(--rift); color: #000; padding: 8px 12px; border-radius: var(--radius);
}
.skip:focus { top: 8px; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  padding-top: env(safe-area-inset-top, 0px); /* 노치 영역까지 헤더 배경을 채운다 */
  background: rgba(10, 12, 16, .94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.top-bar {
  height: var(--top-h);
  display: flex; align-items: center; gap: 24px;
  padding: 0 var(--gutter);
  max-width: 1440px; margin: 0 auto;
}
.brand { display: flex; flex-direction: column; text-decoration: none; line-height: 1.15; flex-shrink: 0; }
.brand-mono { font-family: var(--mono); font-size: 10px; color: var(--sub); letter-spacing: .18em; }
.brand-title { font-size: 18px; font-weight: 700; letter-spacing: .02em; }
.nav-top { display: flex; gap: 4px; margin-left: auto; }
.nav-top a {
  font-family: var(--mono); font-size: 12px; letter-spacing: .08em;
  text-decoration: none; color: var(--sub);
  padding: 6px 10px; border: 1px solid transparent; border-radius: var(--radius);
}
.nav-top a:hover { color: var(--text); border-color: var(--line); }
.nav-top a[aria-current="page"] { color: var(--rift); border-color: rgba(79, 216, 255, .4); background: rgba(79, 216, 255, .06); }

.spoiler-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 6px 10px; font-size: 12px; cursor: pointer; flex-shrink: 0;
}
.spoiler-state { font-family: var(--mono); font-weight: 600; color: var(--sub); min-width: 2.4em; text-align: left; }
.spoiler-toggle[aria-pressed="true"] { border-color: var(--alert); }
.spoiler-toggle[aria-pressed="true"] .spoiler-state { color: var(--alert); }

/* ---------- grade rail ---------- */
.rail {
  height: var(--rail-h);
  display: grid; grid-template-columns: repeat(9, 1fr);
  max-width: 1440px; margin: 0 auto; padding: 0 var(--gutter);
  gap: 2px;
}
.rail-cell {
  --c: var(--sub);
  position: relative;
  border: 0; background: transparent; cursor: pointer;
  font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .08em;
  color: #5D6677;
  border-top: 2px solid #1B212C;
  padding: 0 2px;
  transition: color .2s, border-color .2s, background-color .2s;
}
.rail-cell:hover { color: var(--text); }
.rail-cell.is-present { color: var(--c); border-top-color: color-mix(in srgb, var(--c) 45%, transparent); }
.rail-cell.is-active {
  color: #000; background: var(--c); border-top-color: var(--c);
}
.rail-cell[data-grade="UNK"].is-active { background: #fff; animation: glitch-bg 2.6s steps(1) infinite; }

/* ---------- layout ---------- */
main { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 32px var(--gutter) 64px; outline: none; }
.loading { color: var(--sub); padding: 80px 0; text-align: center; }
.section + .section { margin-top: 56px; }
.sec-head { margin-bottom: 20px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 24px; }
.sec-head > div { flex: 1 1 auto; }
.eyebrow {
  display: block; font-family: var(--mono); font-size: 12px; letter-spacing: .24em;
  color: var(--rift); margin-bottom: 4px;
}
.sec-title { font-size: clamp(22px, 2.4vw, 30px); }
.sec-desc { color: var(--sub); margin-top: 6px; font-size: 14px; }
.sub-title { font-size: 17px; margin-bottom: 12px; display: flex; align-items: baseline; gap: 10px; }
.sub-title .mono { font-size: 11px; color: var(--sub); letter-spacing: .16em; font-weight: 400; }
.count { font-family: var(--mono); font-size: 12px; color: var(--sub); }
.empty { color: var(--sub); padding: 32px; border: 1px dashed var(--line); text-align: center; border-radius: var(--radius); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }

/* ---------- badges / chips ---------- */
.badge {
  --c: var(--sub);
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .06em;
  padding: 2px 8px; border-radius: 2px; line-height: 1.6;
  color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
  background: color-mix(in srgb, var(--c) 10%, transparent);
  white-space: nowrap;
}
.badge.plain { --c: var(--sub); font-family: var(--font); font-weight: 500; letter-spacing: 0; }
.badge[data-grade="UNK"] { animation: glitch-text 3.2s steps(1) infinite; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }

.filters { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.filter-label { font-family: var(--mono); font-size: 11px; color: var(--sub); letter-spacing: .14em; min-width: 72px; }
.chip {
  border: 1px solid var(--line); background: var(--panel); color: var(--sub);
  padding: 5px 12px; border-radius: 999px; font-size: 13px; cursor: pointer; line-height: 1.4;
}
.chip:hover { color: var(--text); border-color: #3A4558; }
.chip[aria-pressed="true"] { color: #000; background: var(--rift); border-color: var(--rift); font-weight: 500; }
.search {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 12px; min-width: 0; width: 280px; max-width: 100%;
}
.search::placeholder { color: #6B7586; }

/* ---------- home ---------- */
.hero {
  position: relative; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius);
  background:
    radial-gradient(ellipse 60% 80% at 85% 20%, rgba(79, 216, 255, .12), transparent 60%),
    linear-gradient(180deg, var(--panel), var(--bg));
  padding: clamp(28px, 5vw, 64px);
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px);
}
.hero-label { font-family: var(--mono); font-size: 12px; color: var(--alert); letter-spacing: .2em; display: flex; align-items: center; gap: 8px; }
.hero-label::before { content: ""; width: 8px; height: 8px; background: var(--alert); border-radius: 50%; animation: blink 1.6s steps(1) infinite; }
.hero-title { font-size: clamp(34px, 6vw, 72px); letter-spacing: -.01em; margin: 14px 0 18px; }
.hero-premise { max-width: 640px; font-size: clamp(15px, 1.4vw, 18px); color: #C9D0DB; }
.hero-meta { margin-top: 20px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 24px; }
.stat { background: var(--panel); padding: 18px 20px; }
.stat-num { font-family: var(--mono); font-size: 34px; font-weight: 600; color: var(--measure); line-height: 1.1; }
.stat-label { font-family: var(--mono); font-size: 11px; color: var(--sub); letter-spacing: .16em; }
.stat-ko { font-size: 13px; color: var(--sub); }

.slider { position: relative; }
.slider-track {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, calc((100% - 5 * 16px) / 6));
  gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.slider-track > * { scroll-snap-align: start; }
.slider-nav { display: flex; gap: 6px; }
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
  font-family: var(--mono);
}
.icon-btn:hover { border-color: var(--rift); color: var(--rift); }
.link-more { font-family: var(--mono); font-size: 12px; color: var(--rift); text-decoration: none; letter-spacing: .08em; }
.link-more:hover { text-decoration: underline; }

/* ---------- character cards ---------- */
.grid { display: grid; gap: 16px; }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; text-align: left; padding: 0; cursor: pointer; width: 100%;
  transition: border-color .2s, transform .2s;
}
.card:hover { border-color: #3A4558; transform: translateY(-2px); }
.card-label {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--mono); font-size: 10px; letter-spacing: .14em; color: var(--sub);
  padding: 8px 12px; border-bottom: 1px solid var(--line);
}
.card-label .type-heroine { color: var(--rift); }
.card-label .type-villain { color: var(--alert); }
.card-media { position: relative; aspect-ratio: 832 / 1216; background: #0D1016; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.card-media::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 40%;
  background: linear-gradient(transparent, rgba(17, 21, 28, .95));
}
.card-body { padding: 10px 12px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-name { font-size: 17px; }
.card-role { font-size: 13px; color: var(--sub); line-height: 1.45; }
.card-body .badges { margin-top: auto; padding-top: 6px; }

.placeholder {
  width: 100%; height: 100%; display: grid; place-items: center;
  font-size: 56px; font-weight: 700; color: #2E3747;
  background: repeating-linear-gradient(45deg, #0F131A 0 10px, #11151C 10px 20px);
}

/* ---------- modal ---------- */
.record-modal {
  width: min(960px, calc(100vw - 24px));
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  padding: 0; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); color: var(--text);
}
.record-modal::backdrop { background: rgba(4, 6, 9, .82); }
.modal-inner { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); }
.modal-media { aspect-ratio: 832 / 1216; background: #0D1016; }
.modal-media img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.modal-info { padding: 24px 28px 28px; display: flex; flex-direction: column; gap: 16px; overflow: auto; max-height: calc(100vh - 50px); max-height: calc(100dvh - 50px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); }
.modal-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-name { font-size: 28px; }
.modal-close { flex-shrink: 0; }
.dl { display: grid; grid-template-columns: 108px 1fr; gap: 10px 16px; border-top: 1px solid var(--line); padding-top: 16px; }
.dl dt { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--sub); padding-top: 3px; }
.dl dd { margin: 0; }
.quote {
  border-left: 2px solid var(--rift); padding: 6px 0 6px 14px; font-size: 17px; color: #fff;
}
.locked { font-family: var(--mono); color: var(--sub); letter-spacing: .08em; }

/* ---------- gates ---------- */
.gk-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.gk { background: var(--panel); padding: 14px 16px; }
.gk-code { font-family: var(--mono); font-size: 11px; color: var(--rift); letter-spacing: .12em; }
.gk-name { font-size: 15px; margin: 2px 0 4px; }
.gk-desc { font-size: 13px; color: var(--sub); line-height: 1.55; }

.grid-gates { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.gate {
  --c: var(--sub);
  position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  border-top: 3px solid var(--c); padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.gate.is-target { box-shadow: 0 0 0 2px var(--rift); }
.gate-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.gate-id { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; color: var(--sub); }
.gate-name { font-size: 17px; margin-top: 2px; }
.gate-region { font-size: 13px; color: var(--sub); }
.alert-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border: 1px solid rgba(255, 77, 94, .5); background: rgba(255, 77, 94, .08);
  padding: 6px 10px; border-radius: 2px;
}
.alert-tag { font-family: var(--mono); font-weight: 600; font-size: 11px; letter-spacing: .2em; color: #fff; background: var(--alert); padding: 1px 8px; }
.alert-text { font-size: 13px; color: #FFC2C8; }
.shift { display: inline-flex; align-items: center; gap: 6px; }
.shift .badge.flip { animation: grade-flip 1.4s .3s 1 both; }

.stairs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; align-items: end; }
.step { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.step-role { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; color: var(--sub); }
.step-role.is-predator, .step-role.is-culprit { color: var(--alert); }
.step-media { aspect-ratio: 1 / 1; border: 1px solid var(--line); background: #0D1016; overflow: hidden; border-radius: 2px; }
.step-media img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.step-name { font-size: 12px; line-height: 1.4; word-break: keep-all; }
.text-chip {
  display: grid; place-items: center; text-align: center; height: 100%; padding: 6px;
  font-size: 12px; color: var(--sub); background: repeating-linear-gradient(45deg, #0F131A 0 8px, #11151C 8px 16px);
}

/* ---------- incidents / timeline ---------- */
.two-col { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 40px; align-items: start; }
.timeline { list-style: none; position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 22px; }
.tl-item::before {
  content: ""; position: absolute; left: -22px; top: 6px; width: 11px; height: 11px;
  border: 2px solid var(--rift); background: var(--bg); border-radius: 50%;
}
.tl-item.is-spoiler::before { border-color: var(--alert); }
.tl-when { font-family: var(--mono); font-size: 11px; color: var(--rift); letter-spacing: .08em; }
.tl-title { font-size: 15px; margin: 2px 0 4px; }
.tl-desc { font-size: 13px; color: var(--sub); }
.redacted { position: relative; }
.redacted .redact-body { filter: blur(6px); user-select: none; pointer-events: none; }
.redact-note { font-family: var(--mono); font-size: 11px; color: var(--alert); letter-spacing: .12em; margin-top: 4px; }

.grid-incidents { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.incident {
  --c: var(--sub);
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--c);
  border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px;
}
.incident-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.incident-code { font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .1em; }
.incident-name { font-size: 16px; }
.incident-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--sub); }
.incident-meta .mono { font-size: 10px; letter-spacing: .12em; margin-right: 4px; }
.incident-summary { font-size: 14px; color: #C9D0DB; }

/* ---------- regions ---------- */
.region-group + .region-group { margin-top: 32px; }
.grid-regions { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.region { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.region-name { font-size: 16px; }
.region-gates { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.region-gates a {
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  font-size: 13px; text-decoration: none; color: var(--text);
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 2px; background: var(--panel-2);
}
.region-gates a:hover { border-color: var(--rift); }

/* ---------- rules ---------- */
.rules-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table caption { text-align: left; font-family: var(--mono); font-size: 11px; color: var(--sub); letter-spacing: .14em; padding-bottom: 8px; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table th { font-family: var(--mono); font-size: 11px; color: var(--sub); font-weight: 400; letter-spacing: .1em; }
.table td.num { font-family: var(--mono); }
.rank-seq { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rank-seq li { display: flex; align-items: center; gap: 6px; }
.rank-seq li + li::before { content: "→"; color: #4A5468; font-family: var(--mono); }
.modes { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; counter-reset: m; }
.modes li {
  counter-increment: m; background: var(--panel-2); border: 1px solid var(--line); padding: 12px; border-radius: 2px; text-align: center;
}
.modes li::before { content: "MODE " counter(m, decimal-leading-zero); display: block; font-family: var(--mono); font-size: 10px; color: var(--sub); letter-spacing: .14em; }

.shards { list-style: none; display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.shard {
  position: relative; aspect-ratio: 1 / 1.1; display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; padding: 14% 10%; gap: 2px;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: linear-gradient(160deg, rgba(79, 216, 255, .22), rgba(79, 216, 255, .04));
}
.shard::before {
  content: ""; position: absolute; inset: 1px; z-index: -1;
  clip-path: inherit; background: var(--panel);
}
.shard { isolation: isolate; }
.shard-no { font-family: var(--mono); font-size: 10px; color: var(--rift); letter-spacing: .12em; }
.shard-skill { font-size: 14px; font-weight: 700; line-height: 1.3; word-break: keep-all; }
.shard-holder { font-size: 11px; color: var(--sub); }
.shard.is-locked { background: linear-gradient(160deg, #2A3242, #161B24); }
.shard.is-locked .shard-skill { font-family: var(--mono); color: #4A5468; }
.roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.role-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.role-step { font-family: var(--mono); font-size: 10px; color: var(--sub); letter-spacing: .14em; }
.role-name { font-size: 16px; margin: 2px 0 4px; }
.role-desc { font-size: 13px; color: var(--sub); }

/* ---------- footer / bottom nav ---------- */
.foot { border-top: 1px solid var(--line); padding: 20px var(--gutter); text-align: center; color: var(--sub); font-size: 13px; }
.foot-meta { font-size: 11px; margin-top: 4px; color: #6B7586; }
.nav-bottom { display: none; }

/* ---------- motion ---------- */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity .5s ease, transform .5s ease; }
.reveal.in { opacity: 1; transform: none; }

.glitch { position: relative; }
.glitch::before, .glitch::after {
  content: attr(data-text); position: absolute; inset: 0; pointer-events: none; opacity: 0;
}
.glitch::before { color: var(--rift); animation: glitch-a 7s 1.2s infinite; }
.glitch::after { color: var(--alert); animation: glitch-b 7s 1.2s infinite; }

@keyframes glitch-a {
  0%, 94%, 100% { opacity: 0; transform: none; clip-path: inset(0 0 0 0); }
  95% { opacity: .8; transform: translate(-2px, 0); clip-path: inset(10% 0 55% 0); }
  97% { opacity: .8; transform: translate(2px, 0); clip-path: inset(60% 0 8% 0); }
}
@keyframes glitch-b {
  0%, 95%, 100% { opacity: 0; transform: none; }
  96% { opacity: .7; transform: translate(2px, 1px); clip-path: inset(35% 0 30% 0); }
  98% { opacity: .7; transform: translate(-1px, -1px); clip-path: inset(5% 0 75% 0); }
}
@keyframes glitch-text {
  0%, 90%, 100% { color: #fff; text-shadow: none; }
  92% { color: #fff; text-shadow: -2px 0 var(--rift), 2px 0 var(--alert); }
  95% { color: #fff; text-shadow: 2px 0 var(--rift), -2px 0 var(--alert); }
}
@keyframes glitch-bg {
  0%, 88%, 100% { background: #fff; }
  90% { background: var(--rift); }
  93% { background: var(--alert); }
}
@keyframes grade-flip {
  0% { transform: rotateX(0); }
  40% { transform: rotateX(90deg); color: var(--alert); border-color: var(--alert); }
  60% { transform: rotateX(270deg); color: var(--alert); border-color: var(--alert); }
  100% { transform: rotateX(360deg); }
}
@keyframes blink { 50% { opacity: .2; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
  .glitch::before, .glitch::after { display: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .nav-top a { padding: 6px 7px; font-size: 11px; }
  .shards { grid-template-columns: repeat(4, 1fr); }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  :root { --gutter: max(16px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px)); --top-h: 52px; }
  .nav-top { display: none; }
  .spoiler-toggle { margin-left: auto; }
  .nav-bottom {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: rgba(10, 12, 16, .97); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .nav-bottom a {
    display: flex; flex-direction: column; align-items: center; gap: 0;
    padding: 8px 2px 9px; text-decoration: none; color: var(--sub); font-size: 12px;
    border-top: 2px solid transparent;
  }
  .nav-bottom a .mono { font-size: 10px; letter-spacing: .1em; }
  .nav-bottom a[aria-current="page"] { color: var(--rift); border-top-color: var(--rift); }
  body { padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px)); }
  .modal-inner { grid-template-columns: 1fr; }
  .modal-media { aspect-ratio: auto; height: 46vh; height: 46dvh; }
  .modal-info { max-height: none; padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px)); }
  .record-modal {
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    overflow: auto; overscroll-behavior: contain;
  }
}
@media (max-width: 600px) {
  body { font-size: 14px; }
  main { padding-top: 20px; }
  .rail-cell { font-size: 9px; letter-spacing: 0; }
  .brand-mono { display: none; }
  .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid-gates, .grid-incidents, .grid-regions { grid-template-columns: 1fr; }
  .card-name { font-size: 15px; }
  .card-label { padding: 6px 8px; font-size: 9px; }
  .card-body { padding: 8px 10px 12px; }
  .slider-track { grid-auto-columns: 46%; gap: 10px; }
  .shards { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .shard-skill { font-size: 12px; }
  .dl { grid-template-columns: 84px 1fr; }
  .modes { grid-template-columns: 1fr; }
  .filter-label { min-width: 100%; }
  .search { width: 100%; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat-num { font-size: 28px; }
  /* 터치 영역 최소 44px */
  :root { --rail-h: 44px; }
  .chip { min-height: 44px; padding: 10px 14px; display: inline-flex; align-items: center; }
  .icon-btn { width: 44px; height: 44px; }
  .spoiler-toggle { min-height: 44px; }
  .search { min-height: 44px; }
}
